如何在ubuntu 16上安装php 5.4?

问题描述 投票:3回答:3

我在ubuntu 16上安装了LAMP堆栈,我得到了php 7。

我想将其降级到php 5.4。我应该使用什么命令删除php 7并在ubuntu 16中安装php 5.4?

php ubuntu lamp
3个回答
0
投票

尝试一下

sudo apt-get purge php *

然后

sudo apt-get install php5.4 php5.4-gettext php5.4-common


0
投票

首先,从您的Ubuntu中删除LAMP。然后,使用以下命令:

sudo apt-get update
sudo apt-get install apache2 php5 mysql-server mysql-client php5-mysql //install php 5.3
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get remove php5 //remove php 5.3
sudo apt-get update
sudo apt-get install php5 //install php 5.4

0
投票

首先,您必须安装PHP 5.4(如果尚未安装):

sudo apt-get install php5-fpm php5-mysql

然后:

Apache:

sudo a2dismod php7.0 ; sudo a2enmod php5.4 ; sudo service apache2 restart

CLI:

sudo update-alternatives --set php /usr/bin/php5.4
© www.soinside.com 2019 - 2024. All rights reserved.