View Single Post
Old 01-31-2005, 09:21 AM   #1
kzant
Green Mole
 
Join Date: Jan 2005
Posts: 6
command line exec() pulls wrong file (php as cgi?)

Hi. Thanks for a great product, and for such a helpful forum. I've got phpdig up and running. Instead of running the indexer for the whole site, I want to index each document as it is added/edited to the site by a web-based administrator.

As such, I'd like to use the exec() command within php and index the file as its edited or added.

I've tested the following command via shell and it worked beautifully.

Quote:
/usr/bin/php -f /path/to/admin/spider.php http://www.site.com/document.doc >> /path/to/spider.log
I check spider.log and see the output of the spider text.

However, when I call from a php script as such:

Quote:
exec(/usr/bin/php -f /path/to/admin/spider.php http://www.site.com/document.doc >> /path/to/spider.log, $out);
It actually indexes the admin page that calls the exec command, not the document http://www.site.com/document.doc

My php is set to run as cgi - I'm sure this has something to do with it and there is some environment variable that I'm missing.

Any advice is appreciated.

Thanks.
kzant is offline   Reply With Quote