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!

  • 2
    Oh no! Please consider reporting this bug to the PHP team. php.net/mailing-lists.php
    – mcandre
    May 7, 2013 at 19:33
  • PHP regularly has broken tests, you may want to build without running them. Also, if the PPA repo has source packages, you may want to get them and start from there. May 15, 2013 at 20:56

3 Answers 3


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).


Use dotdeb. It's like 1 minute work.

  1. Add the main repository to your sources.list

    Depending on your distribution (Wheezy or Squeeze), add these two lines to your /etc/apt/sources.list file (you can also choose a mirror near you) :

    deb http://packages.dotdeb.org wheezy all  
    deb-src http://packages.dotdeb.org wheezy all  


    deb http://packages.dotdeb.org squeeze all  
    deb-src http://packages.dotdeb.org squeeze all  
  2. Fetch and install the GnuPG key.

    wget http://www.dotdeb.org/dotdeb.gpg
    sudo apt-key add dotdeb.gpg
  3. Run apt-get update. You should now be able to install the Dotdeb packages you want with apt-get (or dselect, or aptitude as well…)

and then sudo apt-get install php5-readline

Source: https://www.dotdeb.org/instructions/

  • 1
    Hi bob, welcome to Super User! Can you edit your answer to include the essential information from the link? We do not like URL-only answers. Thanks! Jan 27, 2015 at 18:28
  • Ubuntu 11.10 is an End of Life release, but in Ubuntu 14.04 php5-readline can be installed from the default Ubuntu repos.
    – karel
    Jan 27, 2015 at 19:05

Try to do this, worked for me (Debian):

apt-get install php5-readline

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .