yodarunamok / fxphp

FX.php -- The best way from FileMaker to the Web
http://fx.iviking.org/
44 stars 29 forks source link

Check filemaker connection #43

Closed p-rez closed 4 years ago

p-rez commented 5 years ago

Hi is there a way to check if the server is online before doing a query? Sometimes the server is down and the request just hangs up, i want to show an error page in case the FM server is down

TyrfingMjolnir commented 5 years ago

I use the following as I wrote in 2001; there may be better ways to do this in 2019, but then again this still works to this very date:

global $SYS_ADMIN, $TIMEOUT;
$fp = fsockopen( $hostname, $port, &$errno, &$errstr, $TIMEOUT );

if( $fp ) {
  echo "Port open";
} else {
  echo "Port closed";
}

for checking if the service is open; however when I run nginx as a reverse proxy in front of the CWP there is hardly ever any issues.

p-rez commented 5 years ago

That's exactly what i was looking for, it works as expected thanks @TyrfingMjolnir