Ubuntu16.04.05 + PHP 7.2.6 擴充套件安裝
阿新 • • 發佈:2018-11-11
N1:CURL
# sudo su
# cd
# wget https://curl.haxx.se/download/curl-7.61.0.tar.gz
# tar -zxvf curl-7.61.0.tar.gz
# cd curl-7.61.0
# ./configure --prefix=/usr/local/curl
# make
# make install
# cd
# cd php-7.2.6
# cd ext/curl
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-curl=/usr/local/curl
# make
# make install
1、執行php -m 檢視擴充套件是否成功載入,若不成功,可引數在php.ini檔案中,新增extension=curl
2、嘗試重啟php-fpm
N2:GD
安裝依賴包
freetype:
1、高版本的freetype安裝路徑下可能不存在bin目錄及freetype-config可執行檔案
2、官網地址:https://download.savannah.gnu.org/releases/freetype/
# wget https://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2
# tar jxvf freetype-2.4.0.tar.bz2
# cd freetype-2.4.0
# ./configure --prefix=/usr/local/freetype
# make && make install
jpegsrc:
# wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
# tar -zxvf jpegsrc.v9.tar.gz
# cd jpeg-9
# ./configure --prefix=/usr/local/jpeg
# make && make install
zlib:
官網地址:http://www.zlib.net/
# wget http://www.zlib.net/zlib-1.2.11.tar.gz
# tar -zxvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure --prefix=/usr/local/zlib
# make
# make install
libpng:
官網地址:https://sourceforge.net/projects/libpng/files/libpng16/1.6.35/
# wget https://nchc.dl.sourceforge.net/project/libpng/libpng16/1.6.35/libpng-1.6.35.tar.gz
# tar -zxvf libpng-1.6.35.tar.gz
# cd libpng-1.6.35
# ./configure --prefix=/usr/local/libpng
# make
# make install
安裝gd庫
# wget https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz
# tar zxvf libgd-2.2.5.tar.gz
# cd libgd-2.2.5
# ./configure --prefix=/usr/local/gd
# make
# make install
php原始碼編譯
# cd
# cd php-7.2.6
# cd ext/gd
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg/ --with-png-dir=/usr/local/libpng/ --with-freetype-dir=/usr/local/freetype/ --with-zlib-dir=/usr/local/zlib/ --with-gd=/usr/local/gd/
# make
問題:
錯誤:/root/php-7.2.6/ext/gd/gd.c:57:22: fatal error: X11/xpm.h: 沒有那個檔案或目錄
解決:sudo apt-get install libxpm-dev
# 如果出現上面錯誤:make clean,然後再./configue....,最後再執行make
# make install
# vim /usr/local/php/lib/php.ini,新增extension=gd
# 重啟php-fpm
# php -m