phpinfo and php -v show different version on lion

Viewed 18796

I try to upgrade my php from 5.3.13 to 5.4.5 I've manually download source codes of php 5.4.5 and ./configure then sudo make install it.

after that, I run

php -v

it shows 5.4.5, while I run

<?php phpinfo(); ?>

it shows 5.3.13. what is the problem here and how to fix it. thanks

5 Answers

If you are on ubuntu and your web server is NGNIX, and also you use of php-fpm, you should to change your ngnix config:

in /etc/ngnix/sites-available nano per your address and change the fpm version:

  location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;

then restart your ngnix

$ sudo service nginx restart

now check your php version with phpinfo() and php -v on cli.

Related