您的位置:首页 > 运维架构 > Nginx

REHL5.4 配置nginx1.2.0 PHP5.3.10

2012-05-07 18:51 351 查看
安装包下载

php5:wget http://cn2.php.net/get/php-5.3.10.tar.bz2/from/cn.php.net/mirror
nginx1.2:wget http://nginx.org/download/nginx-1.0.14.tar.gz
安装nginx1.2

#tar xzvf nginx-1.2.0.tar.gz

#cd nginx--1.2.0

#./configure --prefix=/usr/local/nginx

#make && make install

安装成功

#ln -s /usr/local/nginx/sbin/nginx /etc/init.d/nginx

#pkill -9 nginx 强制停止

#service nginx 开始

#nginx -s reload 重启

#echo “/usr/local/nginx/sbin/nginx” >>/etc/rc.local 自动启动

可能出现错误

1、./configure: error: the HTTP rewrite module requires the PCRE library.

You can either disable the module by using --without-http_rewrite_module

option, or install the PCRE library into the system, or build the PCRE library

statically from the source with nginx by using --with-pcre=<path> option.

需要安装库

yum install pcre-devel

安装php-5.3.10

#tar xvf php-5.3.10.tar.bz2

#cd php-5.3.10

#./configure --prefix=/usr/local/php5 --enable-mbstring --enable-fpm --with-jpeg-dir --with-png-dir --with-gd --with-freetype-dir --with-gd --with-mysql=/usr/local/mysql

注 mysql的路径根据你实际安装的路径选择

#make && make install

#cp php.ini-development /usr/local/php5/lib/php.ini

#vi /usr/local/php5/lib/php.ini

修改 date.timezone = PRC 去掉前面的 ;

#cd /usr/local/php5/etc/

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

启动php-fpm

/usr/local/php5/sbin/php-fpm

查看是否启动,看到9000端口表示启动成功

#netstat -antp |grep :9000

安装过程中可能遇见的问题:

1、configure: error: xml2-config not found. Please check your libxml2 installation.

安装rpm -ivh apt-get install libxml2-dev

2、configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/

安装rpm -ivh apt-get install libcurl4-gnutls-dev

3、configure: error: jpeglib.h not found.

安装rpm -ivh libjpeg-dev

4、If configure fails try –with-vpx-dir=<DIR>configure: error: png.h not found.

安装rpm -ivh apt-get install libpng12-dev

5、If configure fails try –with-xpm-dir=<DIR>configure: error: freetype.h not found.

安装rpm -ivh apt-get install libfreetype6-dev

6、configure: error: mcrypt.h not found. Please reinstall libmcrypt.

安装rpm -ivh apt-get install libmcrypt-dev

7、configure: error: Cannot find libtidy

安装rpm -ivh apt-get install libtidy-dev

配置,增加蓝色部分内容,注意web的路径

#vi /usr/local/nginx/conf/nginx.conf

...略

server

{

listen 80;

server_name www.ming-soft.com

location / {

root /web;

index index.html index.htm index.php;

}

location ~ \.php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /web/$fastcgi_script_name;

include fastcgi_params;

}

}

...略

如果以上不用户不使用rpm安装,可能会出现下面的错误

1、编译gd-2.0.35.tar.gz时报错:

gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/local/freetype/include/freetype2 -I/usr/local/freetype/include -I/usr/local/freetype/include -I/usr/local/jpeg/include -g -O2 -MT gd_png.lo -MD -MP -MF .deps/gd_png.Tpo -c gd_png.c -fPIC -DPIC -o .libs/gd_png.o

gd_png.c:16:53: error: png.h: No such file or directory

gd_png.c:47: error: expected specifier-qualifier-list before ‘jmp_buf’

gd_png.c:54: error: expected ‘)’ before ‘png_ptr’

gd_png.c:82: error: expected ‘)’ before ‘png_ptr’

gd_png.c:92: error: expected ‘)’ before ‘png_ptr’

解决办法:

#vi gd_png.c



#include “png.h” /* includes zlib.h and setjmp.h */

替换成:

#include “/usr/local/libpng/include/png.h” /* includes zlib.h and setjmp.h */

然后再make就可以了

注:include“”双引号里包含的是libpng安装的路径里的include文件夹里的png.h文件

2、expat错误:

checking expat.h usability... no

checking expat.h presence... no

checking for expat.h... no

checking xmlparse.h usability... no

checking xmlparse.h presence... no

checking for xmlparse.h... no

configure: error: Cannot find usable expat library. This could mean that your version is too old.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: