See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Running cron jobs under php ver. 5.4

General Tech Bugs & Fixes
Max. 2000 characters

Shiv Thapa


( 6 months ago )

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?

Naveen Shastri


( 6 months ago )


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:


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.

what's your interest