All4172 Posted July 15, 2006 Share Posted July 15, 2006 I'm able to run the file fine through the browser, but it doesn't seem to be able to be executed by the crontab. I end up getting:/home/path/public_html/list.php: line 1: ?php: No such file or directory/home/path/public_html/list.php: line 3: syntax error near unexpected token `('/home/path/public_htmllist.php: line 3: `if ($handle = opendir('/home/empirer1/public_html/marketwire')) {'I've double and triple checked the path (copied the path out of the file in fact). Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/14645-crontab-and-php-script/ Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 i had this problem too. it's running from the shell (if i remember the problem correctly), so you need to add a line to tell it to use php to parse the file. the line i used was:[code]#!/usr/bin/php -q[/code]add that to the top of the file and give it a whirl. the path might need to be changed. Quote Link to comment https://forums.phpfreaks.com/topic/14645-crontab-and-php-script/#findComment-58317 Share on other sites More sharing options...
All4172 Posted July 15, 2006 Author Share Posted July 15, 2006 Ok thanks. Add that to the top of the PHP file? Like:[code]#!/usr/bin/php -q<?phpcode.....[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14645-crontab-and-php-script/#findComment-58319 Share on other sites More sharing options...
akitchin Posted July 15, 2006 Share Posted July 15, 2006 yep, that's what did it for me. Quote Link to comment https://forums.phpfreaks.com/topic/14645-crontab-and-php-script/#findComment-58322 Share on other sites More sharing options...
All4172 Posted July 15, 2006 Author Share Posted July 15, 2006 Thanks that seems to of worked for me to :) Quote Link to comment https://forums.phpfreaks.com/topic/14645-crontab-and-php-script/#findComment-58327 Share on other sites More sharing options...
All4172 Posted July 15, 2006 Author Share Posted July 15, 2006 Any idea how to make it works with something like script.cgi?login=1&un=2........I found this php script but the cron tab returns a "This program can only be run through a web server." when it runs. Although when running it through a browser it works.[code]#!/usr/bin/php -q<?PHP putenv('QUERY_STRING=login=1&id=100&pw=admin100'); passthru("/home/path/public_html/cgi-bin/exec/admin.cgi");?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14645-crontab-and-php-script/#findComment-58381 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.