在我的Ubuntu服务器上更改我的PHP版本

在我的Ubuntu服务器上更改我的PHP版本

问题描述:

Currently using PHP version is 5.6.36 and I need to go down on version 5.3.29.

Running phpinfo()on my script giving me this

enter image description here

While on my cli

enter image description here

For what I understand, I'm still using the version 5.6.36.

Anyway to point the version to different installed php?

目前使用 PHP code>版本是 5.6.36 code>和我 需要关注版本 5.3.29 code>。 p>

在我的脚本上运行 phpinfo() code>给我这个 p>

a > p>

在我的cli上 p>

p>

据我所知,我仍在使用 5.6.36 code>版本。 p>

无论如何将版本指向不同安装的php? p> div>

Your CLI is referenced to PHP-CLI binaries. But Apache uses its internal module (libapache2-mod-php) to process PHP scripts. You have to downgrade the version of libapache2-mod-php.

Try with below commands

# Install the old version of libapache-php
sudo apt-get install libapache2-mod-php5

# Disable PHP 5.6 module
sudo a2dismod php5.6

# Enable php 5.3 module
sudo a2enmod php5

# Restart Apache
sudo service apache2 restart