Nginx php 編譯安裝

2021-06-29 14:12:13 字數 3339 閱讀 4637

步驟一:

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers 

步驟二:

nginx所需要的庫檔案件

yum -y install pcre-devel zlib-devel

步驟三:

php依賴的庫檔案

yum -y install gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel curl-devel

步驟四:

cp -frp /usr/lib64/libldap* /usr/lib/

安裝庫檔案

tar zxvf libiconv-1.14.tar.gz  

cd libiconv-1.14  

./configure --prefix=/usr/local 

make && make install 

tar zxvf libmcrypt-2.5.8.tar.gz  

cd libmcrypt-2.5.8  

./configure  

make && make install 

/sbin/ldconfig  

cd libltdl  

./configure --enable-ltdl-install 

make && make install 

tar zxvf mhash-0.9.9.9.tar.gz   

cd mhash-0.9.9.9/   

./configure  

make && make install 

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la  

ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so  

ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4  

ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8  

ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a  

ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la  

ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so  

ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2  

ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1  

ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config 

tar -zxvf mcrypt-2.6.8.tar.gz   

cd mcrypt-2.6.8/  

/sbin/ldconfig  

./configure  

make && make install 

mkdir -p /

usr/local

/php5.4  

tar zxvf php-5.4.

13.tar.gz  

cd php-5.4.

13export libs="-lm -ltermcap -lresolv"

export dyld_library_path=

"/usr/local

/mysql

5.5/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"

export ld_library_path=

"/usr/local

/mysql

5.5/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"

make zend_extra_libs='-liconv' 

make install 

cp php.ini-production /etc/php.ini

將php-fpm 作為服務執行

cp php-5.4.13/sapi/fpm/init.d.php-fpm  /etc/init.d/php-fpm 

cd /usr/local/php5.4/etc

mv php-fpm.conf.default  php-fpm.conf 

chmod 755 /etc/init.d/php-fpm 

chkconfig --add php-fpm 

chkconfig --level 345 php-fpm on

服務方式啟動php-fpm 

service php-fpm start

編譯安裝nginx

useradd www

安裝pcre

tar zxvf pcre-8.32.tar.gz

cd pcre-8.32/

./configure --prefix=/usr/local/pcre

make && make install

安裝nginx

mac os上編譯安裝nginx php

2.編譯安裝nginx,先現在zlib和pcre 4.先安裝mysql 選擇 為了在編譯php時,先把mysql編譯進去,省的以後為擴充套件編譯mysql 5.在 etc profile中加入如下環境變數 vi etc profile export path usr local mysql bin ...

Ubuntu編譯安裝nginx PHP7 2

wget mkdir p data exec安裝依賴 apt install y libpcre3 libpcre3 dev openssl libssl dev build essential zlib1g dev建立使用者www useradd www s sbin nologin 開始編譯ng...

nginx php動態編譯載入模組

nginx動態編譯載入模組步驟 檢視目前nginx版本及編譯模組 nginx version nginx 1.12.0 built by gcc 4.8.5 20150623 red hat 4.8.5 11 gcc built with openssl 1.0.2k 26 jan 2017 tls...