I’m trying to access the PHP interactive mode via ssh, but after type “php -a”, the prompt answer me “Interactive mode enable”, but I cannot type anything.
Does anyone have the same problem?
I’m trying to access the PHP interactive mode via ssh, but after type “php -a”, the prompt answer me “Interactive mode enable”, but I cannot type anything.
Does anyone have the same problem?
Hey @lincolnlemos –
You’re not alone – I just verified that this is the case in my Local site container.
According to this StackOverflow answer, PHP needs to have the readline
module:
There isn’t an easy way to compile this into the container, but there are a couple of options that you can do to quickly evaluate php code from the terminal, but nothing that’s really interactive:
wp eval '<php-code>'
Ctrl+d
to execute things
php -a
and then adding the full php code and then Ctrl+d
. This will flush the session and therefore isn’t “interactive”, but is a way to get PHP to execute code locally.Hope that helps give a couple of options for working around this!