2 回答
TA贡献1802条经验 获得超6个赞
是的,我必须编译 gd
首先我删除了旧版本 sudo yum remove php-gd
然后检查php版本 php -v
获取源码 sudo wget https://github.com/php/php-src/archive/php-7.2.3.tar.gz
sudo tar zxf php-7.2.3.tar.gz
cd php-src-php-7.2.3/ext/gd/
我必须安装这些 sudo yum install php-devel gd-devel libwebp-devel libjpeg-turbo-devel
sudo yum groupinstall "Development Tools"
sudo yum install libwebp-devel libjpeg-devel libpng-devel zlib-devel libXpm-devel
sudo phpize
sudo ./configure --with-jpeg-dir --with-freetype-dir --with-xpm-dir --with-webp-dir --with-png-dir --with-zlib-dir
sudo make
sudo cp modules/gd.so /usr/lib64/php/modules/
然后编辑 php.ini 以启用 sudo nano /etc/php.ini
添加 extension=gd
那么它是可用的 php -m
php -r 'var_dump(gd_info());'
array(13) {
["GD Version"]=>
string(26) "bundled (2.1.0 compatible)"
["FreeType Support"]=>
bool(true)
["FreeType Linkage"]=>
string(13) "with freetype"
["GIF Read Support"]=>
bool(true)
["GIF Create Support"]=>
bool(true)
["JPEG Support"]=>
bool(true)
["PNG Support"]=>
bool(true)
["WBMP Support"]=>
bool(true)
["XPM Support"]=>
bool(true)
["XBM Support"]=>
bool(true)
["WebP Support"]=>
bool(true)
["BMP Support"]=>
bool(true)
["JIS-mapped Japanese Font Support"]=>
bool(false)
}
- 2 回答
- 0 关注
- 160 浏览
添加回答
举报