Jump to content

Crontab and PHP script


All4172

Recommended Posts

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?
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.