[FX.php List] FX slowness on FMS13

csinfo csinfo at criticalsolution.com
Tue Apr 14 12:59:23 MDT 2015


I have a PHP/FX solution that will  read a text file line by line and write
it to FileMaker. 
The PHP script is run from a windows client command line in this format: php
myuploadscript.php ³thefile.txt²
Using FX as the ³engine².
This has been working nicely until we upgraded to FMS13, it still works but
very slow. The IT dept has done extensive testing and tracing and  says it
is the FX library where the slowness occurs. I know my code may not be using
FX correctly so I have 2 questions:
1. Is someone willing to look at the part of the script that does the
writing to see if there is a better way (below)
2. Could a subset of fx.php be written so the overhead in FX is minimized?
(So only functions needed are included)
Any other ideas?
Thanks in advance, John F

This is the main guts of my PHP script:

<?php
// command line usage: php mof.php "sampleMOF.txt"

require_once ('FX/FX.php¹);

//this data is usually in a server.php include file
$Port='80¹; 
$fmAccount='xmluser';
$fmPass='xmlpass';
$dataSourceType = 'FMPro12';
$fmdb=ŒMyDatabase.fmp12';
$ServerIP='10.77.87.13'; //customer fm13 server

ini_set("auto_detect_line_endings", true);

$Mypath ='c:/common/gcad/MOF/';
$Layout=ŒMyLayout';

//get filename from command line param
$n=1;
while ($n <= 2):
{
eval('$d'. $n .' = $argv[$n];');
}
$n++;
endwhile;

$MyInputFile = $d1;

//open the file and read/write line by line
echo "MOF:writing ".$MyInputFile." to FM\n";

$handle = @fopen($Mypath.$MyInputFile, "r");
if ($handle) {

while (($LineData = fgets($handle,1000)) !== false)
 {

//actually write the line fo FM
if (strlen($LineData) > 1)
{
$linecount=$linecount+1;
$request = new FX($ServerIP, $Port,$dataSourceType );
$request->SetDBData($fmdb,$Layout,'1');
$request->SetDBUserPass($fmAccount, $fmPass);
$request->AddDBParam( ŒFieldName', trim($LineData );
$result = $request->FMNew();

}
//echo $LineData."\n";
}

 if (!feof($handle)){
 echo "Error: unexpected fgets() fail\n";
 }
 fclose($handle);
}

echo $linecount . " lines written to FM\n";
?>






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


More information about the FX.php_List mailing list