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.
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.
相关文章推荐
- LNAMP第二版(nginx 1.2.0+apache 2.4.2+php 5.4)
- nginx1.6 + php5.4+phpmyadmin 编译安装配置
- LNAMP第二版(nginx 1.2.0+apache 2.4.2+php 5.4)
- CentOS5.6(64bit)下编译安装Nginx1.2.0、Percona-Server-5.1.61、PHP5.3.10
- LNAMP第二版(nginx 1.2.0+apache 2.4.2+php 5.4) 推荐
- LNAMP第二版(nginx 1.2.0+apache 2.4.2+php 5.4)
- nginx支持php配置
- LNMP服务器安装配置(Rhel+Nginx+PHP+MySQL)
- 配置Nginx 支持php
- Nginx配置防盗链、Nginx访问控制、Nginx解析php相关配置
- PHP nginx 去掉伪静态的配置
- nginx安装配置、Nginx支持php
- nginx1.9.4 +php 5.5.29+yii2.0配置手册
- LNMP nginx配置和 php-fpm通道详解
- 给nginx配置https服务器并反向代理php
- ubuntu+nginx+php+mysql安装配置方法命令
- 文件配置文件php 5.4 连接不上 mysql 的真正原因!!
- Mac 配置PHP、Nginx、Mysql环境
- nginx php-fpm内存配置问题
- Mac环境下Nginx+PHP+MySQL的安装与配置