Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Dhiraj Patra's Blog:
Running PHP Scripts with Cron
Aug 05, 2008 @ 13:45:03

Dhiraj Patra has posted a tutorial to his "LAM-PHP" blog today looking at a different-than-usual way for running PHP scripts - in the cron.

Lots of programmers like PHP for its ability to code and develop web applications fast. Code-debugging is a lot easier than with PERL or C. However, there is one thing a lot of developers are puzzled about, "How to run PHP Scripts with crontab?"

He explains how cron can be used effectively to replace including a backend script into another file (bad practice) and how to get started with PHP and cron. He includes how to find if you're using a CGI or Apache version of PHP and how to locate the binary. He takes this knowledge and shows how to apply it and put a sample script into the cron file. You can check out sites like this or this for more information on cron itself.

tagged: script cron crontab cgi apache module binary tutorial

Link:

Developer Tutorials Blog:
Running PHP cron jobs - regular scheduled tasks in PHP
May 16, 2008 @ 14:32:25

On the Developer Tutorials blog, Akash Mehta has posted an introduction to working with command-line PHP scripts and cron jobs for site automation.

Scheduled tasks are a fairly common feature in modern web applications. From cleaning out caches every 24 hours to checking subscription periods and even generating reports, more web applications live by the clock than ever before. But how do we schedule the execution of a PHP script on the server side?

He shows the two key things to getting it working - an example of a command-line call to a PHP script (executed through his /usr/bin/php) and an example of a line from a crontab showing how to execute the script at midnight every day.

tagged: cron job crontab commandline execute schedule task tutorial

Link:


Trending Topics: