Tiny Core Linux
Tiny Core Base => TCB Talk => Topic started by: simond on October 15, 2019, 01:05:15 AM
-
I tried php5 and php7-cli on tc10
after entering command "php -a"
it printed "Interactive mode enabled" and then hung,
without giving a "php >" prompt
is there anything else needed for Interactive mode?
tc@box:~$ version
10.1
tc@box:~$ which php
/usr/local/bin/php
tc@box:~$ php -v
PHP 7.3.7(cli)...
tc@box:~$ php -a
Interactive mode enabled
-
it looks like that I need to compile php myself and add readline support?
https://www.php.net/manual/en/features.commandline.interactive.php
If you type 'php -a' and get a response of 'Interactive Shell' followed by a 'php>' prompt, you have interactive shell available (PHP was compiled with readline support). If instead you get a response of 'Interactive mode enabled', you DO NOT have interactive shell available and this article does not apply to you.
You can also check 'php -m' and see if readline is listed in the output - if not, you don't have interactive shell.
Interactive mode is essentially like running php with stdin as the file input. You just type code, and when you're done (Ctrl-D), php executes whatever you typed as if it were a normal PHP (PHTML) file - hence you start in interactive mode with '<?php' in order to execute code.
Interactive shell evaluates every expression as you complete it (with ; or }), reports errors without terminating execution, and supports standard shell functionality via readline (history, tab completion, etc). It's an enhanced version of interactive mode that is ONLY available if you have the required libraries, and is an actual PHP shell that interprets everything you type as PHP code - using '<?php' will cause a parse error.
-
Is the readline extension loaded?
-
Is the readline extension loaded?
thank you.
after loading readline.tcz and adding extension=readline to php.ini, it's ok now.