PHP gd JPEG image support missing. PHP gd FreeType support missing.

解决办法

  首先重新编译安装php

  安装之前先编译安装JPEG和freetype

安装jpeg6

[root@localhost /usr/local]# mkdir /usr/local/jpeg6
[root@localhost /usr/local]# mkdir /usr/local/jpeg6/bin
[root@localhost /usr/local]# mkdir /usr/local/jpeg6/lib
[root@localhost /usr/local]# mkdir /usr/local/jpeg6/include
[root@localhost /usr/local]# mkdir -p /usr/local/jpeg6/man/man1

注:此软件默认不会自动创建所需目录,故目录必须手工创建

# yum -y install libtool*
# cd /lnmp/jpeg-6b
# cp /usr/share/libtool/config/config.sub ./
# cp /usr/share/libtool/config/config.guess ./

复制libtool 中的文件,覆盖jpeg-6b 中的文件

# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make
# make install

--enable-shared 和 --enable-static 参数分别建立共享库和静态库使用的 libtool

安装freetype

# cd /lnmp/freetype-2.3.5
# ./configure --prefix=/usr/local/freetype/ --enable-shared
# make
# make install

安装php

# ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --with-pdo-mysql=/usr/local/mysql --with-gd --without-pear --enable-fpm --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ 
# make && make install

别的配置请看:https://www.cnblogs.com/sswind/p/11996629.html

编译安装 gd

# cd /lnmp/php-7.3.12/ext/gd/
# /usr/local/php/bin/phpize
# ./configure --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype --with-php-config=/usr/local/php/bin/php-config
# make && make install

然后将生成的文件,添加至php.ini文件中,路径会在安装成功之后输出

查看是否支持gd“1”表示命令:

/usr/local/php/bin/php -r 'print_r(gd_info());'
# cd /lnmp/php-7.3.12/ext/gettext/
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make && make install
[root@localhost /usr/local/php/etc]# vim php.ini 
...
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/gd.so
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/gettext.so
...

重启nginx

posted @ 2019-12-26 10:01  一窗明月半帘风  阅读(3582)  评论(0编辑  收藏  举报