Jump to content

exec function doesn't return expected results to $output


tartan75

Recommended Posts

I'm moving webserver (now on my own VPS), and am having problems with an htdig wrapper. the wrapper takes a search requests, runs htsearch by exec function, then parses the results. However the exec function it only returns the text/html header returned by htsearch, not the rest of the results.

 

having spent some time debuging i have established:

1) the VPS is running suphp, therefore (verified by exec(whoami) the code is being run as user alpha.

2) to debug I have hard coded the command into the exec function.

3) to verify that its not an htsearch or user permissions problem i've copied the command from my php code to the shell prompt (while logged in as user alpha), and it runs returning the full results.

4) php returns line 1 (header), and the blank line 2 only. The remaining page of lines is (somewhat fustratingly not returned.

5) to verify that it is not being returned (and not a case of me not correctly handling it once returned), I've also tried passthru with the same results.

 

exec('/usr/bin/htsearch -c /home/psalmsin/htdig/conf/htdig.conf words=psalm',$result);

if ($Debug) {

      while (list($k,$v) = each($result)) {

        echo "$k -> $v \n<BR>";

      }

 

Any advice would be much appreciated.

I've looked into this more and the commend seams to process up to the first space, so

/usr/bin/htsearch

runs, but not

/usr/bin/htsearch -c /home/psalmsin/htdig/conf/htdig.conf words=psalm

 

I'm confused. Any suggestions much appreciated

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.