php5.3 fastcgi方式 安装以及和nginx整合

 

注意:不要随便改变基础库的版本,否则会对别的软件产生编译错误

1、基础依赖包安装:

  

cd /software/zlib-1.2.3
./configure
make
make install 

cd /software/libxml2-2.6.30
./configure --prefix=/usr/local/libxml2/
make 
make install
 
cd /software/libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt/
make 
make install

cd /software/libmcrypt-2.5.8/libltdl
./configure --enable-ltdl-install
make
make install

cd /software/libpng-1.2.31
./configure --prefix=/usr/local/libpng/
make
make install

mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1
cd /software/jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install

cd /software/freetype-2.3.5
./configure --prefix=/usr/local/freetype/
make
make install

cd /software/autoconf-2.61
./configure
make 
make install
 
cd /software/gd-2.0.35
./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/
make
make install

cd /software/ncurses-5.6
./configure --with-shared --without-debug --without-ada --enable-overwrite
make 
make install

 

 

2、安装php

useradd www
groupadd www

./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-fpm-user=www --with-fpm-group=www

make 

make install

cp php.ini-development /usr/local/php/etc/php.ini #php配置文件
cp  /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf  #php-fpm配置文件

 

测试php-fpm.conf文件的正确性

 /usr/local/php/sbin/php-fpm -t

 

php-fpm 不再支持 php-fpm 补丁具有的 /usr/local/php/sbin/php-fpm (start|stop|reload)等命令,需要使用信号控制:

master进程可以理解以下信号

INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块

示例:
php-fpm 关闭:
  kill -INT `cat /usr/local/php//var/php-fpm.pid` #注 如果编译的时候不指定pid文件的路径,需要在php-fpm.conf中指定pid的位置,否则找不到pid文件
php-fpm 重启:
  kill -USR2 `cat /usr/local/php//var/php-fpm.pid`

killall php-fpm   #结束所有php-fpm进程

 

nginx里面打开对php的支持

只需要把这四句的注释打开,注意改下路径

 

 

 

 

 

 编译过程中出现的错误:

In file included from /root/php-5.3.6/ext/gd/libgd/gd_compat.c:8:
/usr/local/jpeg/include/jpeglib.h:938: error: expected declaration specifiers or ‘...’ before ‘FILE’
/usr/local/jpeg/include/jpeglib.h:939: error: expected declaration specifiers or ‘...’ before ‘FILE’
make: *** [ext/gd/libgd/gd_compat.lo] Error 1

解决方法:按如修改

修改完成后 在执行 make clean   configure  、make 、make install 

 

error while loading shared libraries:libltdl.so.3

这可能是共享库设置的问题,其中libltdl.so.3在我的/usr/local/lib下

软件默认安装在 /usr/local/lib 目录下,而此目录默认不在库的搜索路径
vim /etc/ld.so.conf.d/usr.local.conf 内容 /usr/local/lib

 

参考文章:

 http://lxw66.blog.51cto.com/5547576/1316776

http://blog.s135.com/nginx_php_v6/

php5.3 fastcgi方式 安装以及和nginx整合,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。