Wednesday, 26 December 2012

Shell scripts

A Command Line Interface Server Application Programming Interface (CLI SAPI) has existed for 

PHP since v4.2, but only with the release of 4.3 did it come to maturity. In PHP 5 it is built 

automatically, and can be configured to be installed automatically also. Although you can use 

the code given here in previous versions of PHP, you may encounter problems with versions 

prior to PHP 4.3.


If you are not already using shell scripts as part of your daily life, you are probably expending 

too much energy on little tasks! Shell scripts are a great way to automate repetitive tasks, 

receive and process user input, and create basic applications.

Using PHP to build your shell scripts allows you to not only take advantage of the power and 

flexibility inherent to the language, but it also brings you one more step closer to the magical 

day when you can type "rm /usr/bin/perl" and not worry about the repercussions!

PHP-CLI can also be used as part of a daisy-chain between other commands. 

For example: php -f foo.php | sort -u > myfile.txt. 


2 comments:

  1. What's up to all, the contents existing at this site are really awesome for people knowledge, well, keep up the good work fellows.

    Drupal developer London

    ReplyDelete
  2. Hey!
    Thanks for the update, is there any way I can receive an email sent to me when you write a fresh article?


    Vachel
    PHP Developer Chicago
    cmscentral.net

    ReplyDelete