Ubuntu – How to enable readline for PHP 5.4 on Ubuntu 11.10

PHPreadlineUbuntu

I installed PHP 5.4 on my Ubuntu 11.10 PC like this:

$ sudo add-apt-repository ppa:ondrej/php5
$ sudo apt-get update
$ sudo apt-get install php5

It's working fine but I don't have the readline function anymore that I need for my PHP CLI scripts. libreadline-dev is installed and readline was working perfectly in 5.3.

I also tried to compile 5.4 with readline:

$ wget http://de2.php.net/get/php-5.4.0.tar.gz/from/de.php.net/mirror
$ tar xzvf mirror
$ cd php-5.4.0/
$ ./configure --with-readline
$ make test

But the last command echoed this error after compiling for some minutes:

FAILED TEST SUMMARY
Test 7: DTD tests [ext/dom/tests/dom007.phpt]
You may have found a problem in PHP.

I appreciate any help on how to get readline working!

Best Answer

Try with this:

$ cd php-5.4.0/ext/readline
$ phpize && ./configure && make

Then you will end up with a modules/readline.so which can be loaded from php.ini (make install will move it to extension_dir).

Related Question