Page 1 of 1

PHP Coding / PHP Coding Help / exec function doesn't return

Posted: Fri Jan 08, 2010 5:23 pm
by tartan75
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 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, or suggestions on how to investigate this further would be much appreciated. It worked on the old server but doesn't on the new.