Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting cronjob to run PHP script as PHP5

Tags:

php

cron

crontab

I am using 1and1 hosting and trying to run a cronjob using PHP5. For some reason, the cron is using PHP4.. even though the global PHP version on site is PHP5.

The script works fine in a browser, but gives me errors when SSHing and directly running the file. The reason I know it's using PHP4 is because it says "X-Powered-By: PHP/4.4.9"

The cron looks like this:

* * * * * /usr/bin/php /path/to/file.php

I'm thinking it's gotta be something related to the php path. Any ideas?

like image 416
psarid Avatar asked Sep 08 '11 19:09

psarid


1 Answers

Try /usr/bin/php5 ?

That's a common location for PHP 5.

like image 59
dkamins Avatar answered Oct 06 '22 14:10

dkamins