Nginx + PHP
1、查看安装的php
# rpm -qa | grep php
2、删除php
# yum remove php
3、使用yum remove不能彻底删除,要使用 rpm -e xxxx 把第一步列出的扩展 挨个删除,注意依赖情况
# rpm -e php-fpm-5.3.3-22.el6.x86_64
全新安装
1、配置yum源
centos 6.5 # 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 # yum install epel-release # rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
2、使用yum 查看安装包
# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
3、安装,需要其他扩展包在后边加上即可
# 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-fpm 加入系统服务随系统启动而启动
# chkconfig --level 345 php-fpm on
第一次启动php-fpm
# /etc/init.d/php-fpm restart
Stopping php-fpm: [FAILED]
Starting php-fpm: [ OK ]
配置nginx
location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; #php-fpm的端口号 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
重启nginx
# /etc/init.d/nginx -s reload