How to install php5 on ubuntu 16.04

藏色散人
Release: 2023-03-09 14:00:02
Original
2146 people have browsed it

ubuntu16.04安装php5的方法:首先移除默认及已安装的PHP包;然后添加PPA;最后通过“sudo apt-get install php5.6”安装php5.6即可。

How to install php5 on ubuntu 16.04

本文操作环境:ubuntu16.04系统、PHP5.6版,DELL G3电脑

ubuntu 16.04 php5 环境搭建

   

Ubuntu 16.04默认安装php7.0环境,但是php7目前兼容性并不是很好,如果自行安装php5需要清除php7的已安装包,否则会报错。

 

移除默认及已安装的PHP包

 

sudo dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
sudo apt-get install aptitude
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
Copy after login

添加 PPA

sudo add-apt-repository ppa:ondrej/php
   
add-apt-repository: command not found
sudo apt-get install software-properties-common python-software-properties
Copy after login
<br><br><br>
如果不行,apt-get update     apt-get upgrade
 
安装php5.6
sudo apt-get update
sudo apt-get install php5.6
 
安装扩展
sudo apt-get install php5.6-gd
sudo apt-get install php5.6-mysql
 
安装Apache2
sudo apt install apache2
sudo apt-get install libapache2-mod-php5.6
 
安装MySQL
sudo apt install mysql-server php5.6-mysql
这里输入两次密码
sudo apt-get install mysql-client
Copy after login

   推荐学习:《PHP视频教程

The above is the detailed content of How to install php5 on ubuntu 16.04. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template