手动安装Nginx与php5

安装Nginx


1.安装环境包


  1. yum install pcre-devel perl perl-devel perl-ExtUtils-Embed  

2.安装Nginx-1.4.7

  1. wget http://nginx.org/download/nginx-1.4.7.tar.gz  

  2. tar -zxvf nginx-1.4.7.tar.gz  

  3. cd nginx-1.4.7  

  4. ./configure –prefix=/usr/local/nginx –user=nobody –group=nobody –with-poll_module –with-http_ssl_module –with-http_sub_module –with-http_perl_module –with-mail –with-pcre  

  5. make  

  6. make install  


安装php5.4.45

1.安装libiconv软件包

wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz</code> //下载libiconv软件包
tar -zxvf libiconv-1.14.tar.gz //解压软件包
cd libiconv-1.14
./configure --prefix=/usr/local //执行编译配置
make &amp;&amp; make install //编译并安装
ldconfig //执行ldconfig命令,更新动态库缓存

2.
a)环境包安装

yum install beecrypt beecrypt-devel curl curl-devel freetype freetype-devel fontconfig fontconfig-devel gettext gettext-devel ImageMagick-devel mingw32-iconv.noarch libpng libpng-devel libxml2 libxml2-devel libxslt libxslt-devel mhash mhash-devel mcrypt zlib zlib-devel gd gd-devel libjpeg libjpeg-devel openssl openssl-devel openldap openldap-devel

b)还有安装libmcrypt(这个安装php5.4需要版本是2.5.6以上)

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz  //下载
tar -zxvf libmcrypt-2.5.7.tar.gz  //解压
cd libmcrypt-2.5.7  
./configure   //编译
make
make install

3.安装PHP

wget http://cn2.php.net/distributions/php-5.4.45.tar.gz //下载php-5.4.45软件包
tar -zxvf php-5.4.45.tar.gz //解压软件包
cd php-5.4.45
./configure --prefix=/usr/local/php --disable-debug --disable-ipv6 --disable-rpath --enable-bcmath --enable-exif --enable-gd-native-ttf --enable-mbregex --enable-mbstring=all --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-xml --with-config-file-path=/usr/local/php/etc --with-curl --with-curlwrappers --with-freetype-dir --with-gd --with-gettext --with-iconv-dir=/usr/local --with-jpeg-dir --with-ldap --with-ldap-sasl --with-libdir=lib --with-libxml-dir=/usr --with-mcrypt --with-mhash --with-openssl --with-pdo-mysql --with-pear --with-png-dir --with-xmlrpc --with-zlib-dir --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --enable-fpm
make ZEND_EXTRA_LIBS='-liconv' //编译
make install //安装
cp php.ini-production /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 配置文件复制到指定目录下

问题:
1.以下是我在make的时候出现的错误:

/usr/tmp/php-5.4.45/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
make: *** [ext/phar/phar.php] Error 127

解决办法是(我的mysql安装目录是/usr/local/msyql,这个视自己的mysql安装路径而定。)

ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/

64位系统应使用下面的这行

ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章