php与php-FPM安装

1.下载安装包

phpwww.php.net

php-fpmhttp://php-fpm.prg/downloads/

2.配置安装环境

gccgcc-c++

libxml2libxml2-devel

autoconf

libjpeglibjpeg-devel

libpnglibpng-devel

freetypefreetype-devel

zlibzlib-devel

glibcglibc-devel

glib2glib2-devel

若过程中根据不同linux版本安装其他软件包

3.安装phpphp-fpm

cd解压包目录

./configure--prefix=/opt/php--enable-fastcgi--enable-fpm

make

makeinstall

4.配置与优化php-fpm

php/opt/php/lib/php.ini

php-fpm/opt/php/etc/php-fpm.conf

5.管理FastCGI进程(httpserver(eg.nginxapache)<=fastcgi=>动态脚本语言(eg.php))

启动/opt/php/bin/php-cgi--fpm或/opt/php/sbin/php-fpmstart[stop|quit|restart|reload|logrotate]

查看netstat-antl|grep9000或ps-ef|grepphp-cgi

6.配置nginx对php的支持

/opt/nginx/conf/nginx.conf

server{

……

location~\.php${

fastcgi_passunix:/tmp/php-cgi.sock;

fastcgi_indexindex.php;

fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;

includefastcgi_params;//fastcgi_paramsnginx安装时会自动生成

}

……

}

7.testnginx对php的解析功能

localhost对应根目录下创建phpinfo.php

<?phpphpinfo();?>

另:查看CodeIgniter版本号:/system/CodeIgniter.php

相关推荐