1

My hosting company switched me to php version 5.4. I run a Drupal site (D7.) They say:

You'll want to make sure your crons use "/usr/php/54/usr/bin/php" instead, as otherwise it will use PHP 5.2.

How do I do that?

Change the php.ini file? Create a new file?

What is the exact syntax for it?

1 Answer 1

1

You can either call them by specifying the interpreter to load the scripts in the crontab, with this syntax:

* * * * * /usr/php/54/usr/bin/php yourscript.php

Or, alternatively, if you are comfortable modifying the scripts, you can use a shebang line on top of it. To use the shebang line you just need to modify the first line of the script to look like this:

#!/usr/php/54/usr/bin/php

Then you need to make the script executable with chmod +x yourscript.php and then you can directly call it without specifying the interpreter like:

* * * * * yourscript.php

Here is more documentation about the shebang line: shebang

In many cases I think probably the first way (specifying the interpreter in the crontab) would be preferred, because it doesn't require you to modify the script itself.

1
  • Does this look alright? 0 * * * * wget -O - -q -t 1 /usr/php/54/usr/bin/php domainname/cron.php?cron_key=NRRPBAkGsf35jgwteIS4vp2XQJBlLGTYE13bDUAPZlo? The numbers are a Drupal key to run cron from outside the site.
    – user14666
    Commented Jan 4, 2014 at 2:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .