[FX.php List] Approach to replacing a large set of records from one FMP file to another

Steve Winter steve at bluecrocodile.co.nz
Mon Apr 22 11:53:08 MDT 2013


Howdy

I'll tackle what should be the easy part

> Does anyone know how to solve this FastCGI error?

You've got two options that spring to mind here
run your script from the command line - if FastCGI is involved I presume that you're running this through a browser - if you run the same script form the command line you will avoid this issue
add set_time_limit(10) to any loops you have running. This should reset any PHP-related timeouts to 0 every time it's called, and allow (another) 10 secs (insert any number you wish) for the script to run after it's been called.

As to if this is a good way to do it, perhaps to understand that better, what was wrong with FM - FM import…? and have you considered any of the proliferation of FM sync tools which are (mostly) designed for iOS, but could be applied to this issue…?

Cheers
Steve

> Hi folks,
> 
> I currently have a FMP API web publishing system the pulls records from a master FMP db.  Up until now, I have used native scripted FileMaker imports (FMP to FMP) to move records between the dbs.   For a variety of reasons, I would like to use php to perform the imports.  My first attempt at the task was to execute the following steps. In this case, the task is to replace all the web publishing records in the remote system with records from the master (master --> remote). In this case, the data set is 800 records but I have other files which contains 30,000 records.
> 
> 1) Find all current records in remote via PHP
> 2) Create a PHP array containing all RecIDs (for later deletion)
> 3) Perform PHP find on master
> 4) Execute PHP loop to add records one at a time to remote (remote now contains both old and new records)
> 5) Loop through RecID array and delete old remote records one at a time, using PHP.
> 
> When complete, the remote db would theoretically contain only the new records.
> 
> In reality, the process is failing during the Delete loop, producing an HTTP  500 error with message: The FastCGI process exceeded configured activity timeout after about 60 seconds.  Apparently, this is different than the regular PHP max_execution_time, which is already set for 300 seconds. Environment is Windows Server 2008 R2.
> 
> My questions:
> 
> Is this the right way to deal with mass addition and deletion of records between db's using PHP?  I can already see that failure creates a mess...which is now exposed to production.  Perhaps a different method would ensure transactional integrity.
> 
> Does anyone know how to solve this FastCGI error?
> 
> 
> Thanks!
> 
> 
> Jonathan Schwartz
> Exit 445 Group
> jonathan at exit445.com
> www.exit445.com
> cell: 415-370-5011
> 
> Jonathan Schwartz
> jschwartz at exit445.com
> 
> 
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

Steve Winter
+44 777 852 4776
steve at bluecrocodile.co.nz



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20130422/b6df9619/attachment.html


More information about the FX.php_List mailing list