-1

[SOLVED] I have installed PHP 5.4.34 on Centos Apache server, where PHP 5.1.6 was installed previously. I checked the version from command line, it said the current version is PHP 5.4.34, but when I run the website hosted on this server, the message displays "Your host needs to use PHP 5.2.4 or higher". Anyone knows the reason? Thank you very much!

Thank you everyone for your help during past days!! I have reinstalled it from a repository instead of downloading the packages and build it by myself... Then the problem was fixed. The details are as follows for centos 5.x:

1 --> rpm -Uvh https://mirror.webtatic.com/yum/el5/latest.rpm

2 --> yum install php55w php55w-opcache

3 --> yum install yum-plugin-replace

4 --> yum replace php-common --replace-with=php55w-common

5 --> yum install php55w-opcache

The details can be found here for other platforms https://webtatic.com/packages/php55/

Peidong
  • 73
  • 7
  • The PHP code to check version would be wrong – Ashesh Kumar Nov 01 '14 at 11:01
  • @Ashesh Kumar, I did not use the PHP code to check. I use "PHP --version" from command line to check. I have two installations, I installed a up-to-date version from command line...I did not uninstall the original older PHP version. Then When I visited the web hosted on this server, it could not recognize the newer version of PHP, still the original one...Do you have any ideas? – Peidong Nov 01 '14 at 11:53

2 Answers2

1

You should check PHP version by uploading a php file with <?php phpinfo(); ?> & run that through browser.

The reason why am I asking to do so is sometimes there are multiple installations of PHP on the same server. So, if you check in the way I asked, you will came to know loaded configuration file (PHP.ini) & php version for apache.

May be, you are using different installation for command line & web server.

I hope this will help you.

As you confirmed that you have multiple installations, Just check your apache config to change the new PHP path there. From phpinfo file you created to test, check the loaded configutaion file path, that is your OLD php installation INI. You need to change that in apache config httpd.conf & then restart apache.

It will solve your problem.

Apul Gupta
  • 3,044
  • 3
  • 22
  • 30
  • Yes, I installed it through command line. And I think there are two installations of PHP on the same server. When I check the version through "PHP --version", it tell me its the latest version. However, when I run the index.php file, it tells me it is the previous version and asks me to upgrade the PHP. Do you have any idea to solve this? Thanks very much! – Peidong Nov 01 '14 at 11:39
  • Sorry, I just joined the group and I did not have enough reputation i found. When i vote up it, it shows me -1? And it remind me to have enough reputation, sorry for that – Peidong Nov 01 '14 at 11:45
  • who has given -1? please tell me why? – Apul Gupta Nov 01 '14 at 11:47
  • Hmm.. @Peidong did you actually try this in a NEW file? Because phpinfo is not going to "asks me to upgrade the PHP" – rjdown Nov 01 '14 at 11:54
  • @rjdown I did not try that, but checked it using "PHP --version" from command line, and it responds with PHP 5.4.34. When I tried to load my website from the host, it responds me with "Your host needs to use PHP 5.2.4 or higher to run this version of Joomla!"... After I tried to use "curl -I ...", it responds me with "powered by PHP 5.1.X"... – Peidong Nov 01 '14 at 11:57
  • I tried it just now, it shows that the Configuration File (php.ini) Path was /etc/php.ini. May you suggest to how to change that in apache config? I am new to this, thank you! – Peidong Nov 01 '14 at 12:08
  • @Peidong Do you know your apache server config location? – Apul Gupta Nov 01 '14 at 14:36
0

Your best option would be to find the piece of code on that website telling you to use a more recent version, check how it verifies the version number... and correct the code. As it's obviously wrong.

When you're unfamiliar with the language of the code checking the version number feel free to post it here. Maybe in a different question if you want to get faster answers.

Dominique
  • 1,080
  • 14
  • 29