Molet

Centos7.x安装php5.4、5.5、5.6、7.1、7.2

Molet linux 2019-09-20 4787浏览 0

安装php*

安装php5.4 

[root@localhost ~]#     yum -y install php  #默认安装的php为5.4版本

安装php5.5-php7.2

[root@localhost ~]#     yum -y install epel-release  #首先安装epel

更换rpm源

Centos 5.X:

[root@localhost ~]#     rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

CentOs 6.x:

[root@localhost ~]#     rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

CentOs 7.X:

[root@localhost ~]#     rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

[root@localhost ~]#     yum search php55w #查看当前php55w资源

[root@localhost ~]#     yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64  #安装php5.5及5.5常用拓展

[root@localhost ~]#     php -v #查看当前php版本

安装编译指定版本php

https://www.php.net/releases/  到当前网站下载指定的php版本,下载tar.gz安装包

[root@localhost ~]#     yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel #安全钳先安装依赖

[root@localhost ~]#     tar zxvf php-x.x.xx.tar.gz  #解压下载的php安装包

[root@localhost ~]#     cd php-x.x.xx    #进入解压好的目录

[root@localhost ~]#     ./configure   #安装目录配置到/usr/local/php/

运行以上命令时会报错,根据报错安装对应的支持程序即可

当界面提示Thank you for using PHP时,表示成功,


发表评论