Results 1 to 7 of 7

Thread: OpenSuse - 11.4 PHP5 Interactive readline not working

  1. #1

    Default OpenSuse - 11.4 PHP5 Interactive readline not working

    I also posted this question under "networking" but glistwan recommended that I might get more of the right people reading it here under "applications". For the record, here's my other post.

    Basically I've noticed that even with php5-readline installed, php's interactive command line doesn't seem to have proper readline support. Readline should allow `php -a` to operate via an interactive shell type prompt, but it isn't giving me that. It's giving me the non-readline-enabled version where the script must be typed followed by a ctrl-d to get it to evaluate.

    In case some people haven't seen this, here's what the nice, readline-enabled, shell-type version looks like:

    Code:
    Interactive shell
    
    php > echo "string";
    string
    php > quit
    And here's the non-readline version's output (which is what I'm getting on opensuse):

    Code:
    Interactive Mode Enabled
    
    echo "string";
    ^D
    string
    It's not much different with only one line of code but if you need to run several lines of code one at a time the shell version is a life saver.

    After a few day's research I think I've found out what's going on, but it'd be nice if someone else could confirm this. According to the top post on this redhat bug report the readline functionality of `php -a` won't work if readline is loaded as a dynamic module; it must be compiled in.

    Going on that I built php5 from source on my opensuse install with readline compiled in and now `php -a` runs as expected, giving me an interactive prompt.

    Is this just the way php works on opensuse or have I missed another package I should have installed?

  2. #2
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: OpenSuse - 11.4 PHP5 Interactive readline not working

    lytithwyn wrote:
    > Is this just the way php works on opensuse or have I missed another
    > package I should have installed?
    >

    I am far from being an expert in php, but you ran obviously into a trap.
    The php5-readline package has absolutely nothing to do with the interactive
    behaviour of the php command when invoked with -a.
    It is the module which gives you the possibility to use the functions from
    the readline library within your programs so that you can write php programs
    which in turn use readline functionality.
    Obviously the interactive "shell" in php when invoked does not use readline
    as it is compiled for openSUSE, but you solved that anyway by compiling it
    yourself.

    Just wanted to mention where is no bug or so here this are just two
    completely different things.

    --
    PC: oS 11.3 64 bit | Intel Core2 Quad Q8300@2.50GHz | KDE 4.6.2 | GeForce
    9600 GT | 4GB Ram
    Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.6.0 | nVidia
    ION | 3GB Ram

  3. #3

    Default Re: OpenSuse - 11.4 PHP5 Interactive readline not working

    Thanks, martin_helm. Just wanted to make sure I wasn't missing something.

  4. #4
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: OpenSuse - 11.4 PHP5 Interactive readline not working

    lytithwyn wrote:

    >
    > Thanks, martin_helm. Just wanted to make sure I wasn't missing
    > something.
    >

    I saw your problem to late. I honestly would not have known the solution
    (compile with corect configure options), but I know (by accident) the
    purpose for php5-readline.

    --
    PC: oS 11.3 64 bit | Intel Core2 Quad Q8300@2.50GHz | KDE 4.6.2 | GeForce
    9600 GT | 4GB Ram
    Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.6.0 | nVidia
    ION | 3GB Ram

  5. #5

    Default Re: OpenSuse - 11.4 PHP5 Interactive readline not working

    No problem! You probably would probably have seen my question earlier had I posted it in the right place initially.

    Thanks for the help anyway.

  6. #6

    Default Re: OpenSuse - 11.4 PHP5 Interactive readline not working

    Can you tell me where you found the information or exactly what you did? I have been trying to find information on this for ages? Thank you.

    Danilo

  7. #7

    Default Re: OpenSuse - 11.4 PHP5 Interactive readline not working

    I had to build php5 from source and enable readline while doing the "./configure" step. It's been a long time since I did it so I regret to say that I cannot remember the exact command lines I used when compiling or what devel packages I had to install. You might post a new question to ask how do it properly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •