Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a big fan of PHP interactive mode (php -a). Today I decided to install PHP 5.4 to play around a little bit. It's fun to use the new built-in server and all that stuff, but I was very sad when I discovered that the interactive mode doesn't work.

I installed PHP 5.4 on my Ubuntu by adding the PPA:

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

And this is what I get when I run php -a:

$ php -a
Interactive mode enabled

Aaaaand nothing more. As far as I know this PPA follows the newest PHP5 maintained by Debian PKG PHP Team and as far as I know the interactive mode is also usually broken on freshly installed Debians.

Any ideas on how to get it back? Preferably using some other PPA or at least without compiling - that's usually less painful.

share|improve this question
Well, for the moment I will stick with phpsh – s3v3n Dec 12 '12 at 12:39
I suppose this has to do with Debian linking against libreadline instead of libedit for licensing issues. See Debian bug #576218. – gertvdijk Dec 12 '12 at 15:09
Yeah, I've heard something about that. Just wanted to know if someone knows some good PPA to use =/ – s3v3n Dec 12 '12 at 19:22
BTW it's the other way around. libreadline is licensed under GPL with is not compatible with basically anything else than GPL, so PHP has to be compiled with libedit (and there was a bug in libedit...) – oerdnj Mar 26 '13 at 15:44
up vote 10 down vote accepted

My PPA (ppa:ondrej/php5) was created as an exact copy of Debian php5 source package. There was a problem that Debian's libedit didn't include the required patch for interactive mode (at least I thought so, because the bug on libedit wasn't closed). I have just found that this issue has been already solved in libedit (2.11-20080614-4), but the bug wasn't properly closed.

Anyway the good news is that since this bug in libedit has been already solved in Debian, I will be rebuilding php5 with libedit and it will be included from php5 >= 5.4.12-2(~dist+1).

[Edit]: Also there's now php5-readline module, thanks to Andreas Pour, who poked me that it can be built and packaged now.

share|improve this answer
Great! Thank you! – s3v3n Mar 6 '13 at 10:44
JFTR There was a problem with backporting libedit to lucid, so it took a while before I was able to pinpoint to root cause of the link failures. Anyway this is solved now and i386 php5 on lucid was successfully built and amd64 should be ready later today. – oerdnj Mar 7 '13 at 11:22

I've just solved the problem here, a few minutes ago installing the readline module for php5:

$ apt-get install php5-readline
$ php -a

Now it works fine. Don't know about windows, sorry.

share|improve this answer
The question was about linux. Ondřej (@oerdnj) already mentioned readline. Thanks anyway :) – s3v3n Apr 25 '13 at 10:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.