手動安裝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/


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