any PHP CLI books, references ?

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

any PHP CLI books, references ?

Post by saumya »

Can anybody help me with some good references to CLI of PHP.
thanking you
saumya
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

10 seconds of Googling turned up http://www.php-cli.com/

That site has an impressive number of adverts on it. :lol:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

d11wtq wrote:you can keep a session open indefinitely without the standard 30 second timeout.
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.
Post Reply