CentOS7.0 PHP卸载以及安装

2025-10-28 23:36:40

1、第一步: 卸载php5.4

1. 查看php版本

CentOS7.0 PHP卸载以及安装

2、2. 卸载php

CentOS7.0 PHP卸载以及安装

3、3. 查看php是否卸载

php未能完成卸载,还有对应的依赖包。所以需要接着来卸载。

CentOS7.0 PHP卸载以及安装

4、4. 卸载php对应的依赖包

网上的资料是用rpm -e来卸载,但是试了几次都提示不能找到该安装包。

# rpm -e php-mysql-5.1.6-27.el5_5.3# rpm -e php-pdo-5.1.6-27.el5_5.3# rpm -e php-xml-5.1.6-27.el5_5.3# rpm -e php-cli-5.1.6-27.el5_5.3# rpm -e php-gd-5.1.6-27.el5_5.3# rpm -e php-common-5.1.6-27.el5_5.3

自己解决的办法是如下:

CentOS7.0 PHP卸载以及安装

CentOS7.0 PHP卸载以及安装

5、5. 再次查看php是否卸载完成

CentOS7.0 PHP卸载以及安装

6、第二步: 安装php

1. 下载php

CentOS7.0 PHP卸载以及安装

7、2. 上传到服务器,并且解压

CentOS7.0 PHP卸载以及安装

8、3. 安装php

1. 说明:

#–prefix=/usr/php ##PHP安装路径

#–exec-prefix=/usr/bin ##PHP命令执行路径

#–sysconfdir=/etc ##配置文件存放路径

#–with-apxs2=/usr/sbin/apxs ##Apache apxs扩展路径

#–with-mysql=/var/lib/mysql ##mysql路径

#–with-mysqli=/usr/bin/mysql_config ##mysqli路径

#–with-mcrypt ##启用加密模块

CentOS7.0 PHP卸载以及安装

9、2. 出现错误, error: xml2-config not found.

CentOS7.0 PHP卸载以及安装

CentOS7.0 PHP卸载以及安装

CentOS7.0 PHP卸载以及安装

10、3. 接着安装php

CentOS7.0 PHP卸载以及安装

CentOS7.0 PHP卸载以及安装

11、4. 编译php

CentOS7.0 PHP卸载以及安装

12、5. 出现错误提示

CentOS7.0 PHP卸载以及安装

13、网上解决方法如下:

CentOS7.0 PHP卸载以及安装

CentOS7.0 PHP卸载以及安装

14、6. 接着编译php

CentOS7.0 PHP卸载以及安装

15、7. 编译test

CentOS7.0 PHP卸载以及安装

16、8. 安装成功

CentOS7.0 PHP卸载以及安装

17、9. 说明

如果apache不识别php,请对应的在http.conf中添加:

LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .php

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢