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.

  • 1
    Just try removing the PHP that was installed to /usr/local. – Michael Hampton Jan 12 '13 at 17:34
  • I've already done it, but with no luck. php from command line stopped working until I created a symlink ln -s /usr/bin/php /usr/local/bin/php. Btw symlink is not a solution because other commands rely on that path such as pear command. so I need to change this path at the root (I'd like to know where this path is stored in). – cardy Jan 12 '13 at 18:07
  • Just log out and log back in. – Michael Hampton Jan 12 '13 at 19:13
  • @MichaelHampton logged out without any luck. – cardy Jan 15 '13 at 10:36

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.