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
I think I just came from the same problem. I'm using OSX lion and was installing PHP without brew or port was simply using PHP that came with the machine.
I was in need to install mcrypt module to the current php I'm using ( at that moment I didn't realize that there were 2 version of PHP on my machine, and forgot how I install it ), so I install homebrew and after that installing mcrypt using brew. After the installation, I open my browser and through phpinfo() I found that the PHP version is different with the one I install mcrypt module, and so cannot make the module to work.
This is what it showed in terminal :
Windo-MBP:~ herwindoartono$ php --version
PHP 5.3.23 (cli) (built: May 4 2013 06:43:49)
and from the browser ( local apache ), by opening a php page contain phpinfo();
showing PHP 5.3.15 version.. I don't know how I ended with different version on my machine, so I browse and I browse for solutions and found one :
Changing a line in httpd.conf should change which php version I'm using
This is how to change which PHP version to use, base on my experience :
sudo subl /etc/apache2/httpd.conf
note: subl
is for sublime text 2, else you can use nano
.LoadModule php5_module libexec/apache2/libphp5.so
, comment itLoadModule php5_module /usr/local/opt/php53/libexec/apache2/libphp5.so
, for your case just change the php53
to php54
.sudo apachectl restart
Reference : https://github.com/josegonzalez/homebrew-php/issues/448
I don't have much experience in PHP, but I hope this can solve your(or everyone else) problem.
I was facing the very same problem in Ubuntu 14.04, and I did the following:
from the root directory i looked for php.ini
find / -name php.ini
I got two different files, which means I have two different versions of php installed, so
I removed all php versions
sudo apt-get -y purge php*
then reintalled desired php version (in this case 5.6)
sudo apt-get install php5.6
This is a bit of a guess answer since I don't have a mac, but based on my Winodws experience this could only happen if you have 2 php executables and your CLI is using one and Apache is using the other.
In your phpinfo()
output look for the table row Loaded Configuration File
.
I'm on Windows so mine says C:\server\php\5.4.3\php.ini
but of course yours will be different.
If this is not the path that you expect it to be using then you will need to make sure you change the path in your Apache's httpd.conf
file.
Once you have found the httpd.conf file find the line: PHPIniDir
When you have found this line make sure it is pointing at the correct directory for the php.ini file and restart Apache.
I would also say to check the LoadModule php5_module
line is also pointing at the correct file but the chances are that this will be ok if you were using php 5.3 before.
This answer does assume that you have installed the new php version in a different directory but this is all I can think of with the information you have provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With