Stephen Thorpe has a new article posted on the PHPMaster.com site today about using command line PHP to handle some of the automation on your server.
n this article we’ll look at the advantages of using PHP CLI. I’ll show you how to test PHP’s Command Line Interface / Interpreter (CLI) on your server, and then we’ll look at some of the options available for PHP CLI including the interactive shell and how to create executable scripts. Finally, I’ll give you a couple of examples of scripts to use to maintain your server written in PHP.
He introduces the command-line executable for PHP and shows how to use it to create some simple scripts (including ones that take in command-line arguments). He shows how to make a simple script to monitor disk usage (using the unix command "df") and a backup script that copies files/folders over to another device.