[FX.php List] Making sure servers are responding to FX queries

Bob Patin bob at patin.com
Wed Sep 25 10:31:25 MDT 2013


Hi Steve,

Well, that's basically what my test page does; I wrote a function that I can use for each of the servers, but it doesn't seem to error out when the server is non-existent.

Maybe I just need to look again at my error-handling... :)

Best,

Bob Patin
Longterm Solutions LLC
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
FileMaker 9, 10, 11& 12 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet
--
Twitter: bobpatin
AIM: longterm1954
iChat: bobpatin
--
Expert FileMaker Consulting 
FileMaker Hosting for all versions of FileMaker

On Sep 25, 2013, at 10:32 AM, Steven Thoms <sthoms at wavecomm.com> wrote:

> Bob,
> 
> The simplest solution I have found is to test each required file with a -findany request.
> If you get an error, the server isn't responding.
> 
> Before version 11, I think, but maybe sooner the FMDBNames() stopped working in FX. But I used to use this code to test and it was very quick and worked a charm:
> 
> 
> // confirmDatabases
> $strError = '';
> $resultError = 0;
> $query = fmConnect(); // does not require a dbname, for obvious reasons; see below...
> $result = $query -> FMDBNames();
> //print_r($result);
> if ( $query->lastErrorCode != 0 ) {
>    AddError("The databases are not available.<br />The Web Publishing Engine is not responding. ErrorCode:" . $query->lastErrorCode , $strError);
> } else {
>    $searchDbs  = explode("," , REQUIRED_DBS);
>    $dataString = serialize($result['data']);
>    foreach ( $searchDbs as $key=>$dbName ) {
>        if ( strpos($dataString , $dbName) === false ) {
>            $newError = "The " .  $dbName . " database was not available.";
>            AddError($newError , $strError);
>        }
>    }
> }
> if ( $strError != '' )
>    include_once "{$AppLoc}src/error.php";
> 
> 
> With these settings at the top of the page...
> 
> // db access files
> require_once "{$_SERVER['DOCUMENT_ROOT']}/FX/FX.php";
> require_once "{$_SERVER['DOCUMENT_ROOT']}/FX/FM_Errors.php";
> require_once "{$_SERVER['DOCUMENT_ROOT']}/FX/FX_Error.php";
> require_once "{$_SERVER['DOCUMENT_ROOT']}/FX/server_data.php";
> 
> // db defaults
> define ("REQUIRED_DBS", "File1, File2, etc.");
> define ("GROUP_SIZE", "all");
> define ("ERROR_SPACE", "<br />&nbsp;&nbsp;&nbsp;");
> 
> // fx interface functions
> 
> function fmConnect($layout = '' , $groupSize = GROUP_SIZE, $responseLayout='') {
>    $query = new FX(FM_IP, FM_PORT, FM_VERSION);
>    if ( $layout != '' )
>        $query -> SetDBData(FMDB, $layout, $groupSize, $responseLayout);
>    $query -> SetDBUserPass(FM_USERNAME, FM_PASSWORD);
>    return $query;
> }
> 
> I hope that helps,
> 
> Steve
> 
> 
> On Sep 25, 2013, at 11:03 AM, Bob Patin wrote:
> 
>> A while back someone posted their code for monitoring whether a web server is responding to FX queries. 
>> 
>> I have a little test database on each of my FM servers and wrote a page that does a quick query every N minutes, but I don't think it's really telling me the truth.
>> 
>> I say that because I retired one of my FM servers, and yet my page still reports that it's functioning normally... :)
>> 
>> I'd love to get a copy of that code; I think it might've been Webko?
>> 
>> Thanks,
>> 
>> Bob Patin
>> Longterm Solutions LLC
>> bob at longtermsolutions.com
>> 615-333-6858
>> http://www.longtermsolutions.com
>> FileMaker 9, 10, 11& 12 Certified Developer
>> Member of FileMaker Business Alliance and FileMaker TechNet
>> --
>> Twitter: bobpatin
>> AIM: longterm1954
>> iChat: bobpatin
>> --
>> Expert FileMaker Consulting 
>> FileMaker Hosting for all versions of FileMaker
>> 
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>> 
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list