一:安装Nginx
1,添加一个不能登录且没有主目录的用户:
1 # useradd www -M -s /sbin/nologin(www可以用nginx,说明是nginx用户)
2,必要的组件
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.zip
# unzip pcre-8.13.zip
# cd pcre-8.13
# ./configure
# make && make install
(如果有错误提示:
./configure: error: the HTTP rewrite module requires the PCRE library.
请按照下面的安装方法:
安装pcre-devel与openssl-devel解决问题
yum -y install pcre-devel openssl openssl-devel)
MGB,安装出现一个问题 make: *** No rule to make target `build', needed by `default'. Stop.,莫名的奇妙;
安装make:
yum -y install gcc automake autoconf libtool make
安装g++:
yum install gcc gcc-c++
yum -y install openssl openssl-devel
3,编译nginx并安装
# tar -zxvf nginx-1.3.9.tar.gz
# cd nginx-1.3.9
# ./configure --prefix=/opt/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.34
# make && make install
--with-pcre 后面的路径 为源码包解压后的路径,而不是安装路径,否则会报错!
[2].安装PHP
1,安装必要的组件
# yum -y install libjpeg-devel libpng-devel
# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.8.tar.gz(下载,这个路径不一定正确,可以通过其他方法下载)
# tar -zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure
# make && make install
==64位系统==
1 # ln -s /usr/lib64/mysql/ /usr/lib/mysql
==64位系统==
二:编译 php 并安装
# cd php-5.4.9
# ./configure --prefix=/opt/php --with-iconv --with-zlib --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt ='对于libmcrypt的安装目录' --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-mysql --with-mysqli --enable-sqlite-utf8 --with-pdo-mysql --enable-ftp --with-jpeg-dir --with-freetype-dir --with-png-dir --enable-fpm --with-fpm-user=www --with-fpm-group=www
# make && make install
相关错误解决:
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
其实就是curl的dev包没有安装, 解决方案:
终端下
# yum -y install curl-devel
然后就可以继续了
在CentOS编译PHP5的时候有时会遇到以下的一些错误信息,基本上都可以通过yum安装相应的库来解决。以下是具体的一些解决办法: