Can anybody help me with some good references to CLI of PHP.
thanking you
saumya
any PHP CLI books, references ?
Moderator: General Moderators
10 seconds of Googling turned up http://www.php-cli.com/
That site has an impressive number of adverts on it.
That site has an impressive number of adverts on it.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
There really aren't huge differences. The differences onyl affect how arguments are given to scripts (i.e. no GET/POST), how you display data to the user and the fact you can work with STDIN/STDOUT. Obviously, you can't set cookies, do sessions or any other HTTP-based things but you don't really need to because CLI behaves differently anyway - you can keep a session open indefinitely without the standard 30 second timeout.
Interesting things to look at in the manual, if you have the extensions installed:
http://uk2.php.net/ncurses (be sure to check out the user comments -- someone posted a tetris implementation in PHP)
http://uk2.php.net/readline
Those two tools allow you to create some very effective command line applications.
Interesting things to look at in the manual, if you have the extensions installed:
http://uk2.php.net/ncurses (be sure to check out the user comments -- someone posted a tetris implementation in PHP)
http://uk2.php.net/readline
Those two tools allow you to create some very effective command line applications.
That carries it's own issues. You need to be extra careful with loops and recursion, and you should be vigilant that you're unsetting variables and connections that are no longer needed rather than just letting PHP clean up at the end, otherwise you might well hit the PHP memory limit and your script will slow right down.d11wtq wrote:you can keep a session open indefinitely without the standard 30 second timeout.