PHP for the command line

Terminal Time

Author(s):

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.

Read full article as PDF:

Price $2.95

Related content

  • PHP for Sysadmins

    Most admins tend to use the shell, Perl,or Python if they need a system administration script. But there is no need for web programmers to learn another language just to script a routine task. PHP gives admins the power to program command-line tools and even complete web interfaces.

  • Command Line: sed

    Working with a text editor can be difficult if you need to handle frequently recurring tasks or multiple files. sed can save a lot of typing.

  • Bash scripting

    A few scripting tricks will help you save time by automating common tasks.

  • SHC: Bash Script Compiler

    The Bash Shell Script Compiler converts shell scripts directly into binaries. Compiling your scripts provides protection against accidental changes, but you will have to contend with some quirks.

  • Command Line: ls

    The ls command lists files at the command line and gives you many useful details about file properties. With or without colors, this command keeps you on top of your files.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News