|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47468 enable readline for embed sapi
Submitted: 2009-02-21 17:47 UTC Modified: 2013-08-06 09:19 UTC
Avg. Score:4.6 ± 0.7
Reproduced:6 of 8 (75.0%)
Same Version:1 (16.7%)
Same OS:2 (33.3%)
From: admin at mateuszjanowski dot pl Assigned: yohgaki (profile)
Status: Closed Package: Other web server
PHP Version: 5.* OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: admin at mateuszjanowski dot pl
New email:
PHP Version: OS:


 [2009-02-21 17:47 UTC] admin at mateuszjanowski dot pl
Hello, is my first bug report;

I'm using php compiler (phc - with php CLI [5.2.8]. I meet first problem when i started to use readline extension. I compiled php with '--with readline' is working ok but when i compile my program using phc i get;

'Fatal error: status(): Call to undefined function readline() in rcon.php on line 52'.

The phc author tell me to do;

"I would recommend filing a bug with PHP, asking for the readline
extension to be included in the embed SAPI. It seems like an oversight
rather than a feature. In addition, it might be straightforward to
create a patch to fix this yourself. I took a quick look at this, but
I couldn't find where to do this. You might have more luck."

Btw i compiled PHP 5.2.9RC2 version and getting the same error.

Mabye you can help me?

Greetings Mateusz Janowski.

Reproduce code:

Expected result:
0.2 Alpha -
Remote Console: IP:PORT...

Rcon: <You write here commands which is send to the server.>

Actual result:
When i run php -f rcon.php is working OK but after compiling nope;

0.2 Alpha -
Remote Console: IP:PORT...

Fatal error: status(): Call to undefined function readline() in rcon.php on line 52


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-23 14:16 UTC] paul dot biggar at gmail dot com
Here is the context:

I would mark this as a bug, not a feature request. The readline functions are not available in the embed SAPI. However, there is no reason that it should be impossible for an embed user to have access to readline.
 [2009-04-25 12:40 UTC] paul dot biggar at gmail dot com
I believe this also applies to ncurses, pcntl, and libedit.

Here is a patch to fix it:

--- aclocal.m4.orig     2009-04-25 13:11:57.000000000 +0100
+++ aclocal.m4  2009-04-25 13:24:50.000000000 +0100
@@ -962,7 +962,7 @@
   if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then
 dnl ---------------------------------------------- CLI static module
-    if test "$PHP_SAPI" = "cgi"; then
+    if test "$PHP_SAPI" = "cgi" || test "$PHP_SAPI" = "embed"; then

I tested it by building PHP 5.2.6, 5.2.9 and php5.3-200902131730, building with

./configure --enable-embed --with-readline --enable-pcntl --with-ncurses

and running

nm .libs/ | grep readline
(and similarly for pcntl and ncurses)

which verifies that the readline symbols are available. I also ran the test script from Mateusz through phc, and observed that calls to readline now succeeded.

Can the patch be considered for 5.2.10, 5.3 and HEAD?
 [2009-04-25 13:11 UTC] anil at saog dot net
Thank you very much, it works now. Before your solution I tried to change ext/pcntl/config.m4, a line in this file contains "cli" as a function variable;

--- PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared, cli)
+++ PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared)

but i didnt try it, this may also help.
 [2009-04-25 15:38 UTC] admin at mateuszjanowski dot pl
Hi. Yes can i confirm - Paul's patch fixes the problem.

Thank you :).
 [2011-04-08 18:20 UTC]
-Package: Feature/Change Request +Package: Other web server -Operating System: Ubuntu 8.10 Linux +Operating System: * -PHP Version: 5.*, 6CVS (2009-05-05) +PHP Version: 5.*
 [2013-08-06 09:19 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: yohgaki
 [2013-08-06 09:19 UTC]
It seems this issue is fixed.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 07:01:28 2024 UTC