Issue
I have two versions of PHP installed on the server:
$ find / -name php -type f
result:
/opt/rh/php54/root/usr/bin/php
/opt/rh/php55/root/usr/bin/php
I've added php54 path to ~/.bash_profile
$ echo $PATH
result:
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin:/opt/rh/php54/root/usr/bin/php
however $ php -v
still doesn't work.
in fact if I $ cd /opt/rh/php54/root/usr/bin
and run php -v
from the directory itself, it still doesn't work. I get:
-bash: php: command not found
PHP is installed as there are websites running, just command line is not working...
Both
php55-php-cli-5.5.21-4.el6.x86_64
php54-php-cli-5.4.40-2.el6.x86_64
are installed...
Solution
Wrong path:
find results:
/opt/rh/php54/root/usr/bin/php
^^^--- your php binary
$PATH expects only DIRECTORIES. You listed the above path in $PATH, which means that the shell will be searching for .../usr/bin/php/php
. Note the doubled php
. First one is the "directory" that you added in $PATH, while the second one is the program you're trying to run. The $PATH entry should be JUST .../usr/bin/
, WITHOUT the php
.
Answered By - Marc B Answer Checked By - Cary Denson (WPSolving Admin)