5

I'm using MAMP Version 2.0.5 (2.0.5) on Mac OS X Lion 10.7.3. When I try to use php's interactive mode by

/Applications/MAMP/bin/php/php5.3.6/bin/php -a

it displays Interactive mode enabled and then hangs. No commands work.

This forum post says others have found it broken. Has anyone found a fix?

David Xia
  • 5,075
  • 7
  • 35
  • 52

3 Answers3

4

This is most probably caused by the PHP you are using not being compiled with readline support (--with-readline). Some distros dont compile with that option because of problems with the libraries or licencing issues, Debian for example - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=576218

sam
  • 41
  • 1
2

It works fine.

Type this after you see Interactive mode enabled:

<?php
echo "test\n";
?>

and press ctrl+d.

test will be printed.

Also see this question: mac os php intratactive mode has no prompt

To use the default php version that is shipped with OS X, you can do this in a terminal:

mv /Applications/MAMP/bin/php/php5.3.6/bin/php /Applications/MAMP/bin/php/php5.3.6/bin/php.bak
ln -s /usr/bin/php /Applications/MAMP/bin/php/php5.3.6/bin/php
Community
  • 1
  • 1
Tyilo
  • 28,998
  • 40
  • 113
  • 198
  • @DavidXia That's the difference between `Interactive shell` and `Interactive mode`. – Tyilo May 11 '12 at 19:03
  • 3
    Is there a way to get interactive shell? I'll probably just uninstall MAMP and use the pre-shipped Apache and PHP. – David Xia May 11 '12 at 19:44
0

You have to install php5-readline extension

sudo apt-get install php5-readline
felipe_dmz
  • 89
  • 1
  • 10