# 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
@H_
404_33@
用PHP命令查看版本。
@H_
404_33@
# PHP --version
PHP 5.6.0 (cli) (built: Sep 3 2014 19:51:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0,Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev,Copyright (c) 1999-2014,by Zend Technologies
with Xdebug v2.2.5,Copyright (c) 2002-2014,by Derick Rethans
单独安装PHP-fpm
安装PHP5.6版本下的PHP-fpm (不考虑版本情况下安装 输入下列命令:yum--enablerepo=remiinstallPHPPHP-fpm )
yum install --enablerepo=remi --enablerepo=remi-PHP56 PHP PHP-fpm
如果你想在系统启动时自动运行PHP-fpm,输入下列命令:
chkconfig--level345PHP-fpmon
PHP仅安装了核心模块,你很可能需要安装其他的模块,比如MysqL、 XML、 GD等等,你可以输入下列命令:
yum--enablerepo=remiinstallPHP-gdPHP-MysqLPHP-mbstringPHP-xmlPHP-mcrypt
第一次启动PHP-fpm,输入下列命令:
/etc/init.d/PHP-fpmrestart
配置PHP-FPM和Nginx,让他们一起工作
Nginx的配置文件在/usr/local/Nginx/conf/Nginx.conf,输入下列命令编辑这个文件:
vi/usr/local/Nginx/conf/Nginx.conf
server{
listen 80;
server_name localhost;
root /var/www/html;
......
location ~ \.PHP$ {
#root html;
fastcgi_pass 127.0.0.1:9000; fastcgi_index index.PHP; fastcgi_param SCRIPT_FILENAME scripts$fastcgi_script_name; include fastcgi_params; }
}
如果这个scripts导致PHP文件File Not Found!
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
第四步:
@H_
404_33@
现在在/var/www/html目录下建立下列PHP文件index.PHP
文件内容如下:
<?PHP
PHPinfo();
?>
访问:localhost/index.PHP