News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPHacks.com:
Shell Scripting with PHP CLI
August 09, 2006 @ 15:47:50

On PHPHacks.com, there's a new tutorial that covers a a use for PHP that's not utilized nearly enough - working with it on the command line, shell scripting.

As most of us already know, PHP is the best language for developing dynamic web pages available today. Not many people are aware that it can be used as a shell scripting language as well. While PHP as a shell script isn't as robust as Bash or Perl it does have definite advantages, especially if you're like me and are more proficient in PHP than you are in Perl.

The requirements for using PHP as a shell language is that you must compile PHP as a CGI binary instead of as an Apache module. There are certain security issues related to this so please refer to the PHP Manual when doing so.

The author shows a simple example first, just outputting information. He also demonstrates how to grab the input parameters and how to read in from the command line interactively (both single lines and multiple).

2 comments voice your opinion now!
scripting shell cli tutorial arguments interactive scripting shell cli tutorial arguments interactive


blog comments powered by Disqus

Similar Posts

Daniel Cousineau's Blog: Displaying N-Deep Trees (Remember Your Algorithms Course?)

VilkomenJuist.nl: Laravel 4 and NodeJs/Redis pub/sub realtime notifications

NetTuts.com: Testing Like a Boss in Laravel: Models

Abhinav Singh's Blog: MEMQ : Fast queue implementation using Memcached and PHP only

Mike Willbanks' Blog: RPM Packaging - Building and Deploying your own PHP


Community Events





Don't see your event here?
Let us know!


release symfony series community conference threedevsandamaybe language deployment interview podcast introduction framework developer library list bugfix zendserver laravel tips api

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework