# PHP is compiled with the --with-readline option



## c00kie (Jul 11, 2013)

As of PHP 5.1.0, the CLI SAPI provides an interactive shell using the -a option if PHP is compiled with the --with-readline option. 

I'm having problems using the interactive shell on my FreeBSD box. If I run:

`# php -a`
The shell reports:

```
Interactive mode enabled
```
but this just hangs, with a solid blinking square cursor and no prompt for php i.e. 

```
php >
```

I have to ctrl-Z to force the process to quit?

I've done a quick check of my PHP installation. 

`# php -i | less`
These are the first few lines of the preceding command:

```
phpinfo()
PHP Version => 5.4.10

System => FreeBSD my.domain.org 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
Build Date => Jan  5 2013 06:23:10
Configure Command =>  './configure'  '--with-layout=GNU' '--localstatedir=/var' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--enable-mysqlnd' '--with-libxml-dir=/usr/local' '--with-pcre-regex=/usr/local' '--with-zlib-dir=/usr' '--program-prefix=' '--with-apxs2=/usr/local/sbin/apxs' '--with-regex=php' '--with-zend-vm=CALL' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=i386-portbld-freebsd9.0'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/etc
Loaded Configuration File => /usr/local/etc/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php
Additional .ini files parsed => /usr/local/etc/php/extensions.ini
...
```

I dont see an entry for --with-readline anywhere. So my first questions would be:

How do I compile PHP with the '--with-readline' option? 
And what is the exact syntax?


----------



## ondra_knezour (Jul 11, 2013)

You have to install lang/php5-extensions with the READLINE option enabled (readline support (CLI only)).
`# cd /usr/ports/lang/php5-extensions`
`# make config`
`# make install`


----------



## c00kie (Jul 11, 2013)

ondra_knezour said:
			
		

> You have to install lang/php5-extensions with the READLINE option enabled (readline support (CLI only)).


Works like a charm, thank you.


----------



## SirDice (Jul 11, 2013)

The lang/php5-extensions is a meta-port that depends on various php5-* ports. If you don't need all the other stuff that comes with it simply install devel/php5-readline.


----------

