PHP & Filepro
Richard D. Williams
richard at appgrp.net
Wed Jan 18 11:34:01 PST 2017
Use > NUL instead of > /dev/null.
Richard
On 1/18/2017 1:30 PM, Richard D. Williams via Filepro-list wrote:
> Scott,
>
> Your email is long, so I am top posting.
>
> First, change to a bat file like this;
> PFDSK=h;
> PFDATA=h:;
> PFDIR=\serverFolders\serverdrive;
> PFCMARK=70;
> PFFILES=100;
> PFNET=ON;
> pfoutput=c:\fp\output;
> pfnewntconsole=on;
> c:/fp/dreport.exe reports -f php_test -r "1" -r "%1" -rw "%2" -a -u;
>
> save as C:/php_filepro/test.bat
>
> Your filepro export must change to;
> export ascii php=(fn) r=\n f=|
> php(1) = " Filepro PHP test by "<us;
> php(2) = " this is the data passed with -r flag"<@pm;
> php(3) = " this is the data passed with -rw flag"<@pw
> php(4) = " Date by filePro :-"<@t4<@tm
> php(5)="" 'this places a pipe at the end of the data line
>
> Now, getting php to execute this bat file and get the data;
>
> <?php
> $field = "test";
> $id = uniqid('');
> //for testing purposes
> echo ("C:/php_filepro/test.bat " . escapeshellarg($field) . " " .
> escapeshellarg($id) > /dev/null<br>");
>
> system("C:/php_filepro/test.bat " . escapeshellarg($field) . " " .
> escapeshellarg($id) > /dev/null");
> $filename = "C:/php_" . $id . ".txt";
> if (file_exists($filename)) {
> $data = file($filename);
> $size = sizeof($data);
> for ($i = 0; $i < sizeof($data); $i++) {
> $string = $data[$i];
> echo ("String: $string<br>");
> }
> list($data1,$data2,)=split("\|",$string);
> echo ("Data1: $data1 Data2: $data2<br>");
> // delete the file
> // unlink($filename);
> }
>
> If you need to test outside of php, just add a -db to the bat file,
> cut and paste the echoed command line from the page at the C: prompt.
> Once is runs, take out the -db and change the dreport to rreport.
>
> Without testing this (I am more Linux that Windows), it should work.
> there are many ways to get data as entire file that are a structured
> web page, as csv tables that can be read in as data, etc. etc...
>
> I would be happy to help off-list. Just let me know how to get in touch.
> Maybe gotomeeting?
>
> Hope this helps,
>
> Richard D. Williams
>
> On 1/17/2017 10:03 PM, Scott via Filepro-list wrote:
>> Attempting to send to the list again...
>>
>> Hi all again
>>
>>
>> As I wrote in my email, the idea was simple just have PHP trigger a fp
>> report with -r "data" and have filePro write a txt file with the return
>> data. (it could be as a csv or even in a json format. Just any sort of
>> field:data format that can read back into php).
>>
>> I'm running FP ver 4.8 and Windows Server 2008 r2, PHP on IIS.
>> Thankfully it
>> is an internal local machine so I have full control of it but it is
>> still a
>> production machine. And just to answer Richards question, yes it a
>> set of
>> local raid 10 drives on the server that has the filePro data
>> directory. So
>> yes, everything is in the one box. Mind you, I'm not sure how that's
>> relevant as each of the USER machines on the network all use a 'mapped
>> network drive' for the filePro data drive.
>>
>> So, the part of filePro was fairly simple just writing code to select
>> record
>> with the -r flag then output write or export the resulting record. I
>> made
>> test scripts in a new filePro file called Reports (has only the one
>> record.)
>> the script was short just dumping the -r flags and time and date and
>> user
>> info and write file to specific place. I tested from cmd prompt and
>> it did
>> preform as expected, once I has set the required environments sets.
>> But this
>> would run as me with the user privilege.
>>
>> Then build the php to system call the fp report and this is where things
>> come of the tracks ... Without getting something back from filePro
>> (eg. text
>> error output back to php, or screen to the php result fields) it's
>> hard to
>> see why or trace where it goes wrong. I can't use fp debug as I need
>> the fp
>> part to just start, run and export and not ask questions that php can't
>> answer. (as Richard suggested) (it was also questioned that why was I
>> using
>> rreport for test scripts. But it must run with the rreport eventually
>> and I
>> can't use the debug in dreport anyway.)
>>
>> One of the early tests worked. Php executed rreport and it did output
>> a file
>> that only had -r flag data, but the moment I put a lookup in that report
>> processing it fail again. Therefore, it made me think of a memory
>> issue as
>> the lookup file of a real data file that is very large. Then I changed
>> security setting in IIS from IUSR to a appln pool setting (testing)
>> and then
>> back to IUSR it hasn't work again.
>>
>> So just to bring you up-to-date.
>>
>> Tested
>> * CMD
>> * rreport reports -r "rec_no_requested" -rw "output_filename" -a -v
>> sel1 -u
>> (each step has been tested from cmd prompt that it works as expected
>> (shows in task manager as rreport as USER for about 4 secs then closes)
>> (the record select works from the @pw field (but even so there is
>> only 1
>> record in the reports file.))
>>
>> * PHP
>> * $req = 'c:\fp\rreport reports -r "rec_no_requested" -rw
>> "output_filename"
>> -a -v sel1 -u'
>> * $return = exec ($req, $result);
>> (shows in task manager as rreport as IUSR for about 4 secs then
>> closes
>> with no output.)
>>
>> *IUSR has read/write on FP, FILEPRO DATA, FP OUTPUT FOLDER.
>>
>> So where to now?
>>
>> It was suspect that it worked with only the system memory fields but the
>> moment I ask for a lookup it failed. AND more suspect is that it runs
>> rreport and shows in the task manager as IUSR then close but it
>> produces No
>> Output.?
>>
>> I am think it's a IIS security issue, so I'm not sure where to goto
>> for help
>> with that one.
>>
>> With so many systems in play it's hard to point to an exact spot and say
>> there's your problem.
>> Is it a filePro issue that it can't run under the limited access of
>> IUSER in
>> IIS?
>>
>> Does PHP just not allow filePro to run in such a confined way?
>>
>> (is there may be a way to have php just put a file(request) in specified
>> place and have a CRON job look at that place (use windows scheduled
>> tasks
>> that has more privileges) pick it up and then have filePro do the
>> requested
>> file instructions and return the output file. It would just have a
>> wait with
>> no real linking mechanism or error checking).
>>
>>
>>
>>
>>
>>
>> Thanks, in advance.
>>
>> Scott Smith
>>
>>
>> -------- Message --------
>> Subject: Re: PHP & Filepro
>> Date: Tue, 17 Jan 2017 13:18:08 -0500
>> From: Bruce Easton via Filepro-list
>> <filepro-list at lists.celestial.com>
>>
>> Reply-To: Bruce Easton <bruce at stn.com>
>>
>> To: filepro-list at lists.celestial.com
>>
>> In the case where you are running the test script and it shows rreport
>> running, in what way are you running the test script?
>>
>> I ask because, I have had programs on IIS (where I was not allowed to
>> mess with security settings) where I could successfully run batch test
>> scripts via terminal, but where IIS prevented system commands from
>> executing when run via browser. (I was able to relocate the
>> functionality of the system command to a Perl script, where things
>> worked OK. The client did set up IIS to allow *report, *clerk (and
>> Perl) to execute, which works, but IIS did not seem to allow *anything*
>> to be run from a filepro system command. I believe this was not
>> initially an issue, but became an issue when IIS was upgraded.)
>>
>> Bruce Easton
>>
>>
>> ---
>> This email has been checked for viruses by Avast antivirus software.
>> https://www.avast.com/antivirus
>>
>> _______________________________________________
>> Filepro-list mailing list
>> Filepro-list at lists.celestial.com
>> Subscribe/Unsubscribe/Subscription Changes
>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>
>>
>>
>>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://mailman.celestial.com/pipermail/filepro-list/attachments/20170118/2a791fa9/attachment.html>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
>
>
>
More information about the Filepro-list
mailing list