running php files via crontab

running php files via crontab

Posted by: saygoodbye
Posted on: 2006-04-30 10:10:00

I have added this command to my crontab (edited for privacy):
59 * * * * /home/user/domain.domain.com/cache.php

Now what this should do is cache the sizes of all my pages in
domain.domain.com. This is being used to be like mod_bandwidth (I will release source later). However, I got this error:
/home/user/domain.domain.com/cache.php: line 1: ?: No such file or directory
/home/user/domain.domain.com/cache.php: line 2: =: command not found
/home/user/domain.domain.com/cache.php: line 3: =: command not found
/home/user/domain.domain.com/cache.php: line 4: =: command not found
/home/user/domain.domain.com/cache.php: line 5: =: command not found
/home/user/domain.domain.com/cache.php: line 7: syntax error near unexpected token `('
/home/user/domain.domain.com/cache.php: line 7: `$dateDayConfig = strval(date(d) - 1);'

It seems the server doesn't think its php... anyone have any idea on how to fix this? I have a custom copy of php installed as well. So all php runs through:
/home/user/domain.domain.com/cgi-bin/php.cgi

Re: running php files via crontab

Posted by: matttail
Posted on: 2006-04-30 10:26:00

You'll have to tell cron to use php to run this file, or it simply treats it as standard shell scripting.

So it should look something like
59 * * * * /home/usernme/path/to/php /home.user/domain.com/cache.php





-Matttail

Tags: domainphp cgiphp filescachecrontabcgi binline 7syntax errorpromo coderecievebandwidthmodidea