LeoMoon Studios, LeoMoon Designs, Demo Reels, Projects, LeoMoon OS

Tutorials - Web

Running PHP Scrip on Cron

January 25, 2010

If your PHP scripts do not have executable permission (644 or -rw-r--r--) then as part of the command portion of the cron line, you must specify the php interpreter and pass it the filename of the PHP script (including full path to the script from your home directory) that you want executed. Look at the example below:
28 14 * * * /usr/local/bin/php -q /myscript.phtml
6 3 20 4 * /usr/local/bin/php -q /htdocs/www/x.php

The first cron line above will run myscript.phtml located in your home directory every day at 2:28PM. The second line will run the script x.php from your /htdocs/www/ directory once a year on April 20th at 3:06AM.

When you explicitly specify the php interpreter /usr/local/bin/php your scripts need not have filenames ending in .php .phtml .php3 .php4. Conversely, if your script filenames do not end in one of those PHP extensions, then you must explicitly use the php interpreter in the command portion of your cron as above.

The -q flag suppresses HTTP header output. As long as your script itself does not send anything to stdout, -q will prevent cron from sending you an email every time the script runs. For example, print and echo send to stdout. Avoid using these functions if you want to prevent cron from sending you email.

If your PHP scripts do have executable permissions like 755 or -rwxr-xr-x and they have one of the PHP filename extensions above, then you do not need to specify the php interpreter in the command portion of your cron line, like this:
5 17 * * 2 /myscript.php

The above cron would run myscript.php in your home directory every Tuesday at 5:05PM.

Twitter Logs

Love is Comix is 4th link in Google with "love is comics", "love is... comics" and 9th with "love is comic strips" search term.

5 artists faved LeoMoon lmEyeMaker! http://www.creativecrash.com/maya/downloads/scripts-plugins/rendering/misc/c/leomoon-lmeyemaker

275 Love is... comic strips [updated daily at midnight]: http://loveiscomix.com

LeoMoon QuickTweak 70% done! This program will be VERY flexible to be used at large scale for automation, deployment & setup... Stay tuned.

3 people faved LeoMoon LmEyeMaker.

LeoMoon LmEyeMaker is featured @: http://www.heroturko.org/plugins/maya-plugins/272824-autodesk-maya-plug-ins-and-scripts-2009_2011.html

With LeoMoon QuickTweak you can even import your own registry files. Stay tuned.

LeoMoon lmEyeMaker for Maya 1.01. Get it HERE: http://leomoon.com/shop/plugins/leomoon-lmeyemaker-for-maya/

15,500 FREE Online Games are Proudly Hosted @ http://ArcadeNgine.com

LeoMoon Persian TTT is featured 3 times in Tebyan.net! http://bit.ly/d2BDmJ