PHP for the command line

Terminal Time


PHP is not just for websites. Command-line PHP scripting has been around for more than 10 years, which makes the language and its comprehensive libraries eminently suitable for the toolbox of any administrator who manages web servers.

The PHP scripting language is almost inseparably linked with web applications, but PHP can also handle recurring, complex, or simply boring tasks at the command line. A component that made this possible was introduced in version 4.3, which dates back to 2002. The Command Line Interpreter (PHP-CLI) hides in a separate package in most distributions. Typically, it uses the same name as the interpreter – for example, in Debian 6 (Squeeze) and Ubuntu, it is php5‑cli – but for openSUSE 12.1, you only need the complete php5 package.