編譯 gd 擴展

1. 依賴包

1.1 圖形依賴

1.1.1 依賴

libpng-dev 
libjpeg-dev
libxpm-dev

1.1.2 解決

sudo apt-get install libpng-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libxpm-dev

而後:php

--with-png-dir=/usr/lib
--with-jpeg-dir=/usr/lib
--with-xpm-dir=/usr/lib

具體怎麼找來的,可使用 sudo find /usr -iname '*libpng*' 命令查找字體

1.2 字體依賴

1.2.1 依賴

// 這邊無需裝 freetype 1.x (反正我是安裝失敗了....)
freetype 2.x

1.2.2 解決

官網下載code

tar -zxvf freetype-2.8.tar.gz
cd freetype-2.8
sudo ./configure
sudo make 
sudo make install

而後,--with-freetype-dir=/usr/local/include/freetype2,具體查找同上。get

2. 編譯擴展

cd php-7.1.8/ext/gd
sudo phpize
sudo ./configure \
                    --with-png-dir=/usr/lib
                    --with-jpeg-dir=/usr/lib
                    --with-xpm-dir=/usr/lib
                    --with-freetype-dir=/usr/local/include/freetype2
sudo make 
sudo make install

若是提示 freetype-config 未找到,那麼能夠嘗試下從新安裝 freetype2 或者執行 sudo apt-get install libfreetype6-devit

3. 添加擴展

本身 Google、百度 去.....編譯

相關文章
相關標籤/搜索