您的位置:首页 > 运维架构 > Linux

centos 7 安装 php 5.5 5.6 7.0

2017-08-24 16:36 387 查看
查看当前安装的PHP包

[root@node1 ~]# yum list installed | grep php

php56w.x86_64                      5.6.31-1.w7                         @webtatic
php56w-cli.x86_64                  5.6.31-1.w7                         @webtatic
php56w-common.x86_64               5.6.31-1.w7                         @webtatic
php56w-gd.x86_64                   5.6.31-1.w7                         @webtatic
php56w-ldap.x86_64                 5.6.31-1.w7                         @webtatic
php56w-mbstring.x86_64             5.6.31-1.w7                         @webtatic
php56w-mcrypt.x86_64               5.6.31-1.w7                         @webtatic
php56w-mysql.x86_64                5.6.31-1.w7                         @webtatic
php56w-pdo.x86_64                  5.6.31-1.w7


如果有安装包,先删除

yum remove php.4 php56*


配置安装源

[root@node1 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm Retrieving https://mirror.webtatic.com/yum/el7/epel-release.rpm Preparing...                          ################################# [100%]
package epel-release-7-10.noarch (which is newer than epel-release-7-5.noarch) is already installed

[root@node1 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm Preparing...                          ################################# [100%]
package webtatic-release-7-3.noarch is already installed


安装 php 5.5

yum -y 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


安装 php 5.6

[root@node1 ~]# yum -y install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64


安装 php 7.0

yum install -y php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64


安装 php fpm

[root@node1 ~]# yum -y install php55w-fpm
[root@node1 ~]# yum -y install php56w-fpm
[root@node1 ~]# yum -y install php70w-fpm


查看版本

[root@node1 ~]# php -v
PHP 5.6.31 (cli) (built: Jul  7 2017 06:28:10)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies


启动php

[root@node1 ~]# service php-fpm start


关闭

[root@node1 ~]# service php-fpm stop


重启

[root@node1 ~]# service php-fpm restart


查看进程

[root@node1 ~]# ps -ef | grep php-fpm


查看端口

[root@node1 ~]# lsof -i :9000


配置文件在

[root@node1 ~]# vim /etc/php.ini


配置nginx 支持PHP 程序请求访问
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: