如何让nginx使用编译的php5.5

2017-04-08 21:36:35 3381

1.先安装下面环境

rpm -ivh http://www.landui.com/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum groupinstall 'Development Tools'

yum install libmhash-devel

yum install libmhash

yum install libicu-devel

yum install -y gcc gcc-c++ make gmp-devel libc-client-devel zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

2.配置安装libiconv

wget http://www.landui.com/pub/gnu/libiconv/libiconv-1.14.tar.gz

./configure --prefix=/usr/local/libiconv

make && make install

如果出现错误:#make: *** No targets specified and no makefile found.  Stop

可以尝试执行yum install gcc build-essential

3.安装libmcrypt

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt

tar zxvf libmcrypt-2.5.7.tar.gz

cd libmcrypt-2.5.7

./configure

make && make install

如果提示错误make: *** [sapi/cli/php] Error 1

可以先执行make ZEND_EXTRA_LIBS='-liconv'

4.如果是64位系统,执行下面软命令

ln -s /usr/lib64/libc-client.so  /usr/lib/libc-client.so   

cp -frp /usr/lib64/libldap* /usr/lib/                       

ln -s /usr/lib64/libpng.so /usr/lib/libpng.so               

ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so

yum -y install krb5* 

# e:  Check the path given to --with-kerberos (if no path is gi

ln -s /usr/lib64 /usr/kerberos/lib

cp -rp /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so

或者cp -r /usr/lib64/mysql/* /usr/lib/mysql/

5.下载php5.5进行编译

wget http://www.landui.com/distributions/php-5.5.38.tar.gz

./configure --prefix=/usr/local/php5.5 --with-config-file-path=/usr/local/php5.5/etc --with-config-file-scan-dir=/usr/local/php5.5/php.d --with-mysql --with-mysqli --with-iconv-dir=/usr/local/libiconv --with-mhash=/usr --with-icu-dir=/usr --with-bz2 --with-curl --with-freetype-dir --with-gd --with-gettext --with-gmp --with-imap --with-imap-ssl --with-jpeg-dir --with-kerberos --with-ldap --with-mcrypt --with-openssl --without-pear --with-pdo-mysql --with-png-dir --with-xmlrpc --with-zlib --enable-bcmath --enable-calendar --enable-ctype --enable-dom --enable-exif --enable-ftp --enable-gd-native-ttf --enable-intl --enable-json --enable-mbstring --enable-pcntl --enable-session --enable-shmop --enable-simplexml --enable-soap --enable-sockets --enable-tokenizer --enable-wddx --enable-xml --enable-zip --disable-fileinfo --enable-fpm
安装

make && make install

cp php.ini-production /usr/local/php5.5/etc/php.ini

6.添加php5.5到服务项并设置自动启动:

cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php5.5

chmod +x /etc/init.d/php5.5

chkconfig php5.5 on

service php5.5 start

7.设置php-fmp端口
cd /usr/local/php5.5/etc/

cp php-fpm.conf.default php-fpm.conf

vi php-fpm.conf 修改端口127.0.0.1:9000127.0.0.1:9001

8.建立站点端口选择9001

Fastcgi_pass 127.0.0.1:9001


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: