I’m working on a command line PHP script and I’ve come to realize that there is no readline capability compiled into the php5-cli package. That’s too bad, as command line php usage is gaining a lot of popularity.

From what I’ve read, this may be due to licensing issues, which is also too bad.

Why do I want PHP5 readline support? Mostly so that when using interactive php command line scripts, I can use the “up arrow” keystroke to recall my last command, as well as tab completion. Those are my favorite things about the command line and what make it such an efficient way to interact with computers.

UPDATE: I was able to compile and install readline as a module! That makes creating command line PHP applications much easier.

./configure --disable-cgi --enable-cli --with-readline=shared,/usr/include/readline/

Control file:

Package: php5-readline

Version: 5.2.3

Section: web

Priority: optional

Architecture: i386

Depends: php5-cli (>=5.2), libreadline5

Maintainer: Albert Lash

Description: PHP 5 Readline Shared Object Helpful in the creation of interactive command line scripts written in PHP.

Package contents:

php5-readline

php5-readline/etc

php5-readline/etc/php5

php5-readline/etc/php5/conf.d

php5-readline/etc/php5/conf.d/readline.ini

php5-readline/usr

php5-readline/usr/lib

php5-readline/usr/lib/php5

php5-readline/usr/lib/php5/20060613+lfs

php5-readline/usr/lib/php5/20060613+lfs/readline.so

php5-readline/DEBIAN

php5-readline/DEBIAN/control

php5-readline_5.2.3.deb

Note: The above debian package was created with my very limited experience! Use at your own risk!

UPDATE November 12, 2007: Thanks to an email exchange with Felipe (see my new post on the php5-xsltcache package), the licensing issue with a php5-readline has been confirmed. So this package will not make it into the debian repositories. See debian bug report #341864 regarding php5-readline licensing issues.

¥