Saturday, January 29, 2022

[FIXED] PHP cli only works with "-n"

Issue

I'm stuck for days on a PHP CLI problem :

I have no ouptut, just a blank line and the cursor waiting for instructions when I run :

php -r "echo 1;"

But when I run this line with -n (No php.ini file will be used), everything works :

php -nr "echo 1;"

My real problem is that my composer shortcut (/bin/composer) doesn't work anymore and I have to write php -n /bin/composer every time now.

I work on Debian Wheezy and my PHP version is up to date (5.4.4-14).

I reinstalled php many times without success. Please, can you help me ?


Solution

Reinstall php5-cli and php5-common packages as well as any other dependencies that you need such as libssh2-php as you mentioned above.

sudo apt-get install --reinstall php5-common php5-cli


Answered By - Drew Hammond

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.