AnsweredAssumed Answered

Timeout with error 502 using PHP API after FM Server upgrade to v13

Question asked by DaveWasmuth on Sep 16, 2014
Latest reply on Apr 1, 2015 by TSGal

Summary

Timeout with error 502 using PHP API after FM Server upgrade to v13

Product

FileMaker Server

Version

13.0.3

Operating system version

Windows 2008 Enterprise Edition SP1r2, IIS version 7.5

Description of the issue

We have some automated scripts on Linux that import data to and export data from a FileMaker Server hosted database (UserID).  A PHP script runs on the Linux system and makes calls to the FileMaker PHP API to connect to the FileMaker Server via cURL/HTTPS/IIS.  We recently upgraded the FileMaker Server from version 11 to 13.

After updating the PHP API on the Linux system with the API that is delivered with FMS13, the import and export scripts are able to authenticate successfully and make API calls, including the running of FM scripts.  The import process loads up some staging tables in the FM UserID DB, then calls a FM script that runs for 8-12 minutes to process the staged data. 

The execute() method of the object returned by PHP API’s newPerformScriptCommand() seems to timeout after 2 minutes, returning the following error:

Communication Error: (22) The requested URL returned error: 502 - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.

The FM script continues to completion, but something along the way stops listening.  The FileMaker PHP API seems to be returning a 502 error code received in the HTTP response.  The IIS log seems to indicate that the request was successful, code 200.  I’m not sure how ARR and FastCGI are employed in the FileMaker setup, but my assumption is that FastCGI is for executing the PHP that calls the FM API in a web page and would not come into play when the API is invoked on a remote system.  It seems like the FM Web Publishing Engine or whatever is fielding the HTTP request generated by the FM PHP API is throwing the 502 after it gives up waiting for the FM script to complete.

We found two timeout type things in the various configurations that were set to 2 minutes and changed them to 20 minutes, but neither addressed the problem.  They were the IIS Response timeout and the ARR Timeout.  The FM Admin tool does not seem to have any timeout value for the Web Publishing Engine.  FastCGI had one that was 90 seconds, rather than 120, so I don’t think that’s it.

Are there any other more hidden timeouts or anything that might be causing this?  What actual components are used in what way in the interface between the FileMaker PHP API and the actual FileMaker Server?  The documentation is not very clear about the particulars.  Any help would be greatly appreciated.

Steps to reproduce the problem

Use the newPerformScriptCommand() method of the FM PHP API to make a call to a FM script that runs longer than two minutes with a default web publishing enabled FileMaker Server.  Preferably, run from a standalone PHP script, rather than PHP imbedded in a web page being rendered by the IIS instance from the FileMaker Server installation.

Expected result

The newPerformScriptCommand().execute() returns without error when the long-running FM script has completed.

Actual result

The newPerformScriptCommand().execute() returns with the following error after waiting 2 minutes for the script to complete:

Communication Error: (22) The requested URL returned error: 502 - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.

Exact text of any error message(s) that appear

Communication Error: (22) The requested URL returned error: 502 - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.

Workaround

Have to do manual imports and exports, which is error prone, or give an anonymous login write access to the database.

Outcomes