php53u-cli missing readline support

Asked by booi

The php53u-cli package is missing readline support which hinders some of our php-based cli tools.

If possible, can we create a php53u-readline package or compile it in be default?

I believe it should be compiled in by default as both el5 and el6 distributions contain readline and is a fairly minimal requirement. Would only add readline as a requirement and readline-devel as a build requirements.

Question information

Language:
English Edit question
Status:
Answered
For:
IUS Community Project Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jeffrey Ness (jeffrey-ness) said :
#1

Greetings,

Which package and package version are you using? I show readline is available in the php53u-cli and php54-cli package:

$ rpm -qp http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/php53u-cli-5.3.13-1.ius.el5.x86_64.rpm --provides | grep readline
php53-readline
php53u-readline

$ rpm -qp http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/php54-cli-5.4.3-1.ius.el5.x86_64.rpm --provides | grep readline
php-readline
php54-readline

-----

Can you please provide a 'rpm -qa | grep php' on your system,
and also a 'rpm -q php53u-cli --provides' (assuming you are using php53u).

Thanks

Revision history for this message
booi (booi) said :
#2

Ah, I forgot to mention this and was probably important. php53u-cli actually claims to provide readline when it indeed does not. Please examine the compile options for php closely and you will see "--without-readline"

[root@mamori ~]# rpm -qa | grep php
php53u-pecl-memcache-3.0.6-3.ius.el6.x86_64
php53u-devel-5.3.13-1.ius.el6.x86_64
php53u-mbstring-5.3.13-1.ius.el6.x86_64
php53u-pear-1.9.4-3.ius.el6.noarch
php53u-common-5.3.13-1.ius.el6.x86_64
php53u-pdo-5.3.13-1.ius.el6.x86_64
php53u-mysql-5.3.13-1.ius.el6.x86_64
php53u-xml-5.3.13-1.ius.el6.x86_64
php53u-mcrypt-5.3.13-1.ius.el6.x86_64
php53u-5.3.13-1.ius.el6.x86_64
php53u-intl-5.3.13-1.ius.el6.x86_64
php53u-pecl-apc-3.1.9-4.ius.el6.x86_64
php53u-cli-5.3.13-1.ius.el6.x86_64
php53u-xmlrpc-5.3.13-1.ius.el6.x86_64
[root@mamori ~]# rpm -q php53u-cli --provides
php-cgi = 5.3.13-1.ius.el6
php-cli = 5.3.13-1.ius.el6
php53-cgi = 5.3.13-1.ius.el6
php53-cli = 5.3.13-1.ius.el6
php53-pcntl
php53-readline
php53u-cgi = 5.3.13-1.ius.el6
php53u-pcntl
php53u-readline
php53u-cli = 5.3.13-1.ius.el6
php53u-cli(x86-64) = 5.3.13-1.ius.el6

[root@mamori ~]# php -i | more
phpinfo()
PHP Version => 5.3.13

System => Linux mamori.sf.crunchyroll.com 2.6.32-220.17.1.el6.x86_64 #1 SMP Wed May 16 00:01:37 BST
2012 x86_64
Build Date => May 8 2012 15:39:53
Configure Command => './configure' '--build=x86_64-unknown-linux-gnu' '--host=x86_64-unknown-linux
-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '-
-bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/us
r/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedi
r=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--
with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disabl
e-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--
with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--with
-t1lib=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '-
-with-openssl' '--with-pcre-regex' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp'
'--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg'
'--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-mime-magi
c' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--enable-force-c
gi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--e
nable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '
--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr' '--with-mys
qli=shared,/usr/lib64/mysql/mysql_config' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx
=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlread
er=shared' '--enable-xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-pdo=sh
ared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr/lib64/mysql/mysql_config'
 '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--en
able-json=shared' '--enable-zip=shared' '--without-readline' '--with-libedit' '--with-pspell=shared'
 '--enable-phar=shared' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/
usr' '--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' '--enable-posix=s
hared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' '--with-icu-d
ir=/usr' '--with-enchant=shared,/usr' '--with-recode=shared,/usr'

Revision history for this message
Jeffrey Ness (jeffrey-ness) said :
#3

It does appear readline is not available:
  http://www.php.net/manual/en/function.readline.php

# php
<?php
//get 3 commands from user
for ($i=0; $i < 3; $i++) {
        $line = readline("Command: ");
        readline_add_history($line);
}

//dump history
print_r(readline_list_history());

//dump variables
print_r(readline_info());
?>
Command: a
Command: a
Command: s
PHP Fatal error: Call to undefined function readline_list_history() in - on line 9

Revision history for this message
booi (booi) said :
#4

Here's a runtime example. It's possible this was an oversight as RH provided readline support as a separate package in el5.

[root@mamori ~]# php -a
Interactive shell

php > print_r(readline_list_history());
PHP Fatal error: Call to undefined function readline_list_history() in php shell code on line 1

Revision history for this message
Jeffrey Ness (jeffrey-ness) said :
#5

I believe I tracked down why readline was removed:

  * Wed Feb 10 2010 BJ Dierkes <email address hidden> - 5.3.1-2.ius
   - Build with libedit support in place of readline

This was most likely related to the below bug:

  https://bugs.php.net/bug.php?id=48873

Revision history for this message
Jeffrey Ness (jeffrey-ness) said :
#6

According to the PHP libedit replaces readline:

$ ./configure --help | egrep "libedit|readline"
  --with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)
  --with-readline[=DIR] Include readline support (CLI/CGI only)

I do show readline() is still available by means of the libedit compile:

# php
<?php
print 'Enter name: ';
$name = readline();
print "Welcome $name";
?>

Enter name: Jeff
Welcome Jeff

-----

Can you help with this problem?

Provide an answer of your own, or ask booi for more information if necessary.

To post a message you must log in.