1、配置yum源
CentOS 6.5 追加epel及remi源
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
CentOS 7.0 追加epel及remi源
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege)。
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
2、安装PHP5.6
yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd php-pdo php-redis php-zip
安装php-fpm
yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm
设置php-fpm开机启动
cent6
chkconfig php-fpm on
cent7
systemctl enable php-fpm.service #如果服务是开启状态,使用此命令会启动失败。
systemctl list-units --type=service #查看运行的服务
3.配置php.ini
vim /etc/php.ini
date.timezone = Asia/Shanghai
把 date.timezone = PRC 改成 date.timezone = Asia/Shanghai,如果有分号记得去掉分号.
配置php-fpm
find / -name www.conf
sudo vim /etc/php-fpm.d/www.conf
编辑配置
user = nginx【注:是用户名】
group = nginx
security.limit_extensions = .php .php3 .php4 .php5 .html # 这一行不修改也行
有部分博客推荐使用 user root; 但实际上会启动失败。
4.强制卸载全部php安装包
必须强制删除,使用下面命令查看全部php软件包
rpm -qa|grep php
清除已安装的全部php
yum remove php-*
再用
php -v
查看版本信息已经没有提示
网友评论