
在Amazon Linux 2 for elastic beanstalk php 上,它附帶了freetype 2.3.11,它無法為我的專案呈現正確的字體,因此我下載了freetype 2.10.1 並根據以下內容構建了不帶/帶harfbuzz 的版本:http://www.linuxfromscratch.org/blfs/view/svn/general/freetype2.html。然後我編譯了 php gd 擴展,如下所示。
cd php-7.2.19/ext/gd
phpize
./configure --with-php-config=/usr/bin/php-config --with-gd --with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --with-webp-dir=/usr
make
sudo cp modules/gd.so /usr/lib64/php/7.2/modules/
但是當我運行php -v 時,我得到“PHP警告:PHP啟動:無法加載動態庫'gd.so'(嘗試過:/usr/lib64/php/7.2/modules/gd.so(/usr/lib64 /php /7.2/modules/gd.so:未定義符號:php_gd_gdImageJpegCtx),/usr/lib64/php/7.2/modules/gd.so.so(/usr/lib64/php/7.2/modules/gd.so. so:不能開啟共享物件檔案:沒有這樣的檔案或目錄))在第 0 行未知”
答案1
我在設定命令中缺少 --with-jpeg-dir=/usr 。我以為如果類似的事情是錯的,它就不會編譯,但我想不會。現在可以了。
$ php -i | grep -i "freetype"
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.10.1