Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just upgraded to PHP 5.4.11 from 5.3.15 following this link. After upgrading I ran php -v but it shows me following output.

Zafars-MacBook-Pro:php-5.4.11 zafar$ php -v
PHP 5.3.15 with Suhosin-Patch (cli) (built: Jul 31 2012 14:49:18) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

which says PHP 5.3.15. Then I issue this command /usr/local/bin/php -v which shows following output

Zafars-MacBook-Pro:/ zafar$ /usr/local/bin/php -v
PHP 5.4.11 (cli) (built: Jan 26 2013 20:10:19) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Which shows PHP 5.4.11. When I issue which php it shows me this path /usr/bin/php. I tried following to solve this issue.

  1. I went to /usr/bin/php and rename that php file to php_OLD.
  2. Now I made a symlink in "/usr/bin/" to "/usr/local/bin/php" file using following command

    sudo ln -s /usr/local/bin/php /usr/bin/php

  3. Now I issued php -v command which worked and showed new version of php.

** But when I created phpinfo.php file with phpinfo(); function. It still uses older version of PHP i.e. PHP 5.3.15. why and how can I solve this problem?**

share|improve this question
    
Have you tried moving /usr/local/bin before /usr/bin in $PATH? –  Tuan Anh Tran Jan 27 '13 at 11:03
    
I haven't touch $PATH at all. How can I do this step? –  x4ph4r Jan 27 '13 at 11:22
    
When I do echo $PATH then it shows this output /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin –  x4ph4r Jan 27 '13 at 11:23
    
you can edit default path by sudo nano /etc/paths ; move the line with /usr/local/bin above /usr/bin –  Tuan Anh Tran Jan 27 '13 at 14:02
    
It didn't work. It still shows older version in phpinfo();. however, php -v command shows new version of php. –  x4ph4r Jan 27 '13 at 16:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.