php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51695 CLI interactive mode broken without readline/editline
Submitted: 2010-04-29 12:07 UTC Modified: 2020-10-07 12:44 UTC
Votes:35
Avg. Score:4.5 ± 0.6
Reproduced:32 of 32 (100.0%)
Same Version:14 (43.8%)
Same OS:11 (34.4%)
From: IMadeThisUpForBugzilla at yahoo dot com Assigned:
Status: Verified Package: CGI/CLI related
PHP Version: master OS: any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-04-29 12:07 UTC] IMadeThisUpForBugzilla at yahoo dot com
Description:
------------
Run php at the command line in Windows in interactive mode (php -a), echo something, nothing happens until the process is ended (see test script for example command line session). Doesn't work in PHP 5.3.X. Does work in PHP 5.2.X.

Tried Zend build, version shipped with eclipse, and version distributed on windows.php.net VC6 and VC9.

Test script:
---------------
c:\php> .\php.exe -an
Interactive mode enabled

<?php
echo 'hi';
^Z
hi
c:\php> 


Expected result:
----------------
Session example included. Should output the string 'hi' to the console after "echo 'hi';" (this is correct in PHP 5.2.X)

Actual result:
--------------
Nothing output after executing "echo 'hi';" line. See test script for example session at command line.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-02 00:35 UTC] geissert@php.net
-Summary: CLI interactive output not displayed +Summary: CLI interactive mode broken without readline/editline
 [2010-05-02 00:35 UTC] geissert@php.net
This can be reproduced by building the CLI SAPI without readline/editline support (like we currently do at Debian because of an editline bug.)

One has to send an EOF so that the input is processed, but one can not do anything afterwards: php exits.
 [2010-08-18 13:19 UTC] peter at niederlag dot de
unfortunatly as of now this makes the interactive shell mostly useless for debian users. :-<
 [2012-08-31 15:25 UTC] luis dot pessoa67 at ibest dot com dot br
This code works fine:

(tag ?> missing)

c:\php> .\php.exe -an
Interactive mode enabled

<?php
echo 'hi';
?>
^Z
hi
c:\php>
 [2013-08-01 23:25 UTC] yohgaki@php.net
-Status: Open +Status: Verified -Operating System: Windows XP SP 3 +Operating System: any -PHP Version: 5.3.2 +PHP Version: master
 [2013-08-01 23:25 UTC] yohgaki@php.net
May be we should print error & exit when readline/editline is not available.
 [2013-08-01 23:25 UTC] yohgaki@php.net
May be we should print error & exit when readline/editline is not available.
 [2015-08-17 04:56 UTC] lb1 dot 3 at juno dot com
This is still not working in PHP7-nightly Zend package and Ubuntu 14.04, but works ok with the standard Ubuntu-PHP.
 [2015-10-16 19:08 UTC] bugs dot php dot net at majkl578 dot cz
Confirmed, still broken in PHP 7.0.0RC5 on Linux.
 [2020-10-07 12:44 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem
 [2020-10-07 12:44 UTC] cmb@php.net
This works as expected; without readline you have the "interactive
mode" which works differently from the "interactive shell".  In
interactive mode you have to type a complete PHP script, and
afterwards to press CRTL+d (POSIX) or CTRL+z followed by ENTER
(Windows) to evaluate the script.  See user note 108006 for
further details.

The only thing that is suboptimal, is that the message reporting
whether the interactive shell or the interactive mode would be
enabled, is compiled statically what may lead to erroneous info.
You still can distinguish interactive mode/shell, because only for
the latter the prompt ("php >") is shown.

[1] <https://www.php.net/manual/en/features.commandline.interactive.php#108006>
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Oct 24 18:01:28 2020 UTC