nginx小总结(五)

nginx连接php

nginx本身只支持静态的文本,当处理动态网页的时候,则需要借助于其他模块(插件),比如动态的php,就需要fast-CGI模块,fast-CGI去连接php-fpm,首先,我们得编译安装php

[root@host2 ~]# rpm -qa php          如果之前安装过,需要卸载掉重新安装!

gcc  make等都是要按装的

################################################

tar zxf libiconv-1.13.1.tar.gz                              #加强系统对支持字符编码转换的功能
cd libiconv-1.13.1/
./configure --libdir=/usr/local/lib64
make && make install

###################################################

如果安装的是1.14

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xvf libiconv-1.14.tar.gz
cd libiconv-1.14
make && sudo make install

如果你的glibc版本在2.16以上,make时很有可能出现如下错误

In file included from progname.c:26:0:
./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
^

参考这里的方法,下载patch文件,解压后打上patch即可。

在libiconv-1.14目录下执行

wget -O - http://blog.atime.me/static/resource/libiconv-glibc-2.16.patch.gz | gzip -d - | patch -p0

或者考虑直接注释掉srclib/stdio.in.h文件的第698行(应该没问题),即

//  _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");


#################################################
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

php-5.5.15# ./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir=/usr/local/webserver/freetype/ --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=phphuser --with-fpm-group=phpuser  --with-ldap --with-ldap-sasl --with-mcrypt=/usr/local/webserver/libmcrypt/ --with-mhash=/usr/local/webserver/mhash --with-mysql

各种参数、重点是--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

貌似这篇只能说道php的安装了,未完待续。。。。




























































你可能感兴趣的:(nginx小总结(五))