Php – Change php path

installationPHP

I've a server running Centos 5. Yesterday I upgraded php to 5.4.10 throught remi repository.
Operation was successful ( I've checked updated information in phpinfo())
Today I figured out that php launched from shell, displays a different version (5.2.16). This version is the previous one.
If I do

which php

output is: /usr/local/bin/php
while the new php 5.4 binary is /usr/bin/php

From what I understood, php was manually compiled in the system and there are no source installation files around.

How can I change the path usr/local/bin/php to /usr/bin/php.
I dont'k know where to look for.

Best Answer

After digging into documentation and others great Linux stuffs I've found the solution. All depends from $PATH environment variable, specifically from the order of the directory listed in.

#original $PATH
echo $PATH
/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin

So, I moved /usr/local/bin at the end of the string, and everything start working again:

export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin

Now I've to make this edit persistent, because export instruction expires with session end.