nginx小總結(五)
nginx小總結(四)
http://www.2cto.com/os/201303/192406.html
nginx連接php www.2cto.com
nginx本身只支持靜態的文本,當處理動態網頁的時候,則需要借助於其他模塊(插件),比如動態的php,就需要fast-CGI模塊,fast-CGI去連接php-fpm,首先,我們得編譯安裝php
[root@host2 ~]# rpm -qa php 如果之前安裝過,需要卸載掉重新安裝!
gcc make等都是要按裝的
tar zxf libiconv-1.13.1.tar.gz #加強系統對支持字符編碼轉換的功能 www.2cto.com
cd libiconv-1.13.1/
./configure --libdir=/usr/local/lib64
make && make install
tar jxf libmcrypt-2.5.8.tar.bz2 # mcrypt mhash是php加密算法擴展庫
cd libmcrypt-2.5.8
./configure –libdir=/usr/local/lib64
make && make install
cd libltdl
./configure --libdir=/usr/local/lib64 --enable-ltdl-install
make && make install
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure --libdir=/usr/local/lib64
make && make install
[root@host2 mhash-0.9.9.9]# vim /etc/ld.so.conf 在裡面添加
include /usr/local/lib64
ldconfig /usr/local/lib64 讓系統重新加載lib庫,必須有
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
./configure --libdir=/usr/local/lib64
make && make install
yum install net-snmp-devel curl-devel libxml2-devel libpng-devel libjpeg-devel freetype-
devel gmp-devel openldap-devel -y
php的准備工作已經OK!
useradd -M -s /sbin/nologin www
tar jxf php-5.3.6.tar.bz2cd php-5.3.6
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir--with-freetype-dir --without-pear --with-gettext --with-gmp --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-mbstring --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libdir=lib64 --with-ldap --with-ldap-sasl --with-
mcrypt --with-mhash
各種參數、重點是--enable-fpm,還有,那個mysql現在我們是沒有安裝的可以去掉,在實際中,還是應該先安裝mysql!
make ZEND_EXTRA_LIBS='-liconv'
make install
wget http://pear.php.net/go-pear.phar
/usr/local/webserver/php/bin/php go-pear.phar