天天看點

nginx php動态編譯加載子產品.

#Nginx動态編譯加載子產品步驟

#檢視目前Nginx版本及編譯子產品

#[root@centos7 ~]# /opt/app/lnmp/nginx-1.12.0/sbin/nginx -V

#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 SNI support enabled

#configure arguments: --prefix=/opt/app/lnmp/nginx-1.12.0 --with-pcre=/opt/app/lnmp/pcre-8.40

#

#下載下傳nginx-1.12.0源碼包,并且解壓.比如加載--with-http_ssl_module子產品

#cd nginx-1.12.0

#./configure --prefix=/opt/app/lnmp/nginx-1.12.0 --with-pcre=/opt/app/lnmp/pcre-8.40 --with-http_ssl_module

#make  

###########################切記不能make install#####################

#此時源碼包裡的objs多了一個nginx啟動檔案.進入cd /opt/download/nginx-1.12.0/objs

#備份原來二進制nginx啟動檔案.

#\mv /opt/app/lnmp/nginx-1.12.0/sbin/nginx /opt/app/lnmp/nginx-1.12.0/sbin/nginx.bak

#\cp nginx  /opt/app/lnmp/nginx-1.12.0/sbin/nginx

#平滑啟動: /opt/app/lnmp/nginx-1.12.0/sbin/nginx -s reload

----若是平滑更新則在平滑重新開機前,源碼目錄下make upgrade .源碼包要比現有包新穩定版.

動态編譯php

@進入源碼包.

/opt/download/php-7.1.5/ext && ls

@進入需要加載的子產品.如何GD

cd gd

@然後用原來編譯安裝好的php啟動目錄下的phpize生成configure

[root@centos7 gd] /opt/app/lnmp/php-7.1.5/bin/phpize  回車.

@把編譯配置加入安裝好的php-config

[root@centos7 gd] ./configure --with-php-config=/opt/app/lnmp/php-7.1.5/bin/php-config

[root@centos7 gd] make && make install

@編譯完成後生成的檔案存放在,完成沒有報錯會提示如下.

/opt/app/lnmp/php-7.1.5/lib/php/extensions/no-debug-non-zts-20160303/

@ 修改php.ini檔案extension支援gd.so

本文轉自  一招拜師  51CTO部落格,原文連結:http://blog.51cto.com/sadoc/1946875