11. PHP’s Command-Line Interface

PHP is known and loved as one of the best technologies for generating dynamic Web sites. Inevitably, developers started asking: If I can use PHP for Web pages, why can’t I use it for other things, too? Why not, indeed! The people behind PHP came around to this way of thinking circa PHP 4.2, and PHP CLI (Command Line Interface) was born. As of PHP 4.3, it’s part of the default configuration for all installations. Now you can do the equivalent of shell scripting (command-line programming) using your favorite language, PHP.

PHP CLI lets you run PHP scripts and even snippets of PHP code outside of a Web browser. On Windows, the action takes place within a DOS prompt (aka a console or command window). On Unix and ...

Get PHP 5 Advanced: Visual QuickPro Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.