安装php
我的是阿里云服务器,centos版本是CentOS release 6.9 (Final)
#先安装一下php的源
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
#执行以下命令安装php
yum install php70w.i386 php70w-cli.i386 php70w-common.i386 php70w-fpm.i386 php70w-gd.i386 php70w-mysql.i386 php70w-opcache.i386 php70w-pdo.i386
Centos7
#先安装一下php的源
yum install epel-release
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7*.rpm
#执行以下命令安装php
Yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-fpm.x86_64 php70w-gd.x86_64 php70w-mysql.x86_64 php70w-opcache.x86_64 php70w-pdo.x86_64
安装完后可以通过以下命令查看安装了哪些php相关的包
yum list installed | grep php
php70w.i386 7.0.22-2.w6 @webtatic
php70w-cli.i386 7.0.22-2.w6 @webtatic
php70w-common.i386 7.0.22-2.w6 @webtatic
php70w-fpm.i386 7.0.22-2.w6 @webtatic
php70w-gd.i386 7.0.22-2.w6 @webtatic
php70w-mysql.i386 7.0.22-2.w6 @webtatic
php70w-opcache.i386 7.0.22-2.w6 @webtatic
php70w-pdo.i386 7.0.22-2.w6 @webtatic
以上只提供基本的,需要扩展的话,yum list php7*可以先列出php7相关的所有安装包,然后选择需要的扩展单独安装
比如需要mcrypt扩展,就执行yum install php70w-mcrypt.i386 ,执行后需要重启fpm即可,无需修改php.ini
Centos6 : service php-fpm restart
centos7: systemctl restart php-fpm