Can not use command line interpreter

前端 未结 9 1039
盖世英雄少女心
盖世英雄少女心 2021-02-05 09:58

I have tried to execute simple php code in the php interpreter. When I executed the command php -a I getting the message

Interactive mode ena

9条回答
  •  终归单人心
    2021-02-05 10:34

    Because module readline not installed. http://php.net/manual/en/features.commandline.interactive.php

    This is how I install the module by recompiling php source codes:

    Find previous Configure command:

    $ php -i | grep configure
    Configure Command =>  './configure'  '--prefix=/usr/local/php7' ...
    

    Then recompile:

    ./configure --prefix=/usr/local/php7 \
    --with-readline \
    
    ...
    
    $ make clean 
    $ make
    $ make test 
    $ sudo make install
    

    Check if readline module installed:

    $ php m | grep readline
    readline
    

    Then start php Interactive shell:

    $ php -a
    Interactive shell
    
    php >
    

提交回复
热议问题