php与php-FPM安装
1.下载安装包
php www.php.net
php-fpm http://php-fpm.prg/downloads/
2.配置安装环境
gcc gcc-c++
libxml2 libxml2-devel
autoconf
libjpeg libjpeg-devel
libpng libpng-devel
freetype freetype-devel
zlib zlib-devel
glibc glibc-devel
glib2 glib2-devel
若过程中根据不同linux版本安装其他软件包
3.安装php php-fpm
cd 解压包目录
./configure --prefix=/opt/php --enable-fastcgi --enable-fpm
make
make install
4.配置与优化php-fpm
php /opt/php/lib/php.ini
php-fpm /opt/php/etc/php-fpm.conf
5.管理FastCGI进程(http server(eg.nginx apache)<=fastcgi=>动态脚本语言(eg.php ))
启动 /opt/php/bin/php-cgi --fpm 或 /opt/php/sbin/php-fpm start[stop|quit|restart|reload|logrotate]
查看 netstat -antl|grep 9000 或 ps -ef |grep php-cgi
6.配置nginx对php的支持
/opt/nginx/conf/nginx.conf
server{
……
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;//fastcgi_params nginx安装时会自动生成
}
……
}
7.test nginx对php的解析功能
localhost对应根目录下创建phpinfo.php
<?php phpinfo(); ?>
另:查看CodeIgniter版本号:/system/CodeIgniter.php