Detailed tutorial on Linux (Ubuntu) installation and perfect uninstallation of PHP7

coldplay.xixi
Release: 2023-02-17 19:00:02
forward
2533 people have browsed it

Detailed tutorial on Linux (Ubuntu) installation and perfect uninstallation of PHP7

推荐(免费):PHP7

一、安装

我第一次安装php的时候没有安装apache的php模块,结果apache不能解析php文件,访问文件显示的是源码。

一个命令搞定:安装php7和apache的php7模块:

apt-get install php7.0 libapache2-mod-php7.0

重启apache:

/etc/init.d/apache2 restart

在/var/www/html目录下新建文件info.php

内容如下:

Copy after login

访问:http://你的主机IP/info.php

Detailed tutorial on Linux (Ubuntu) installation and perfect uninstallation of PHP7

看到这个表示php7安装ok。

查看php7相关组件:apt-cache search php7

Detailed tutorial on Linux (Ubuntu) installation and perfect uninstallation of PHP7

安装两个重要的组件,特别是php7.0-mysql,使php7获得mysql的支持

apt-get install php7.0-mysql php7.0-gd


二、卸载(第一种)

sudo apt-get - -purge remove libapache2-mod-php7.0 php7.0 php7.0-gd php7.0-mysql (安装了哪些组件就跟上名字,我这里只安装了这4个) sudo apt-get autoremove php7.0
Copy after login

三,卸载(第二种)

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

查询,卸载已安装php,就卸载完了。
(如果aptitude命令报错就安装aptiude:apt-get install aptitude)

如果想要安装其他php版本:
添加支持源

add-apt-repository ppa:ondrej/php

接下来就apt-get安装就好了


四、php打开session支持

在php.ini里找到session.auto_start = 0(我新安装的php5默认值就是0),把0改为1就可以了。

The above is the detailed content of Detailed tutorial on Linux (Ubuntu) installation and perfect uninstallation of PHP7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!