加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php Call to undefined function imagettftext()问题解决

发布时间:2020-12-13 21:22:23 所属栏目:PHP教程 来源:网络整理
导读:测试代码出现报错Call to undefined function imagettftext(),发现是gd库出现了问题 通过phpInfo()查看 gd库已经开启,但是里边没有freeType 和jpeg的支持 但有png的支持 估计是 freetype 跟 jpeg没有安装 于是安装这两软件 yum install freetype* yum inst

测试代码出现报错Call to undefined function imagettftext(),发现是gd库出现了问题

通过phpInfo()查看 gd库已经开启,但是里边没有freeType 和jpeg的支持 但有png的支持
估计是 freetype 跟 jpeg没有安装

于是安装这两软件

yum install freetype*
yum install libjpeg*

装完后 找一下库装到哪里去了

find / -name freetype

结果在 /usr/include/freetype2/ 文件夹中

同理 libjpeg 在 /usr/include 中

然后进入php源代码的 php源代码(下载的代码)/ext/gd文件夹中 利用phpize进行拓展安装


(我的php安装在/usr/local/php中)
/usr/local/php/bin/phpize

./configure --with-freetype-dir=/usr/include/freetype2 --with-jpeg-dir=/usr/include --with-php-config=/usr/local/php/bin/php-config

然后

make
make install

到此 完成了php中GD库到重新编译,重启后问题圆满解决

Ps:
执行phpize的时候出现报错提示

Cannot find config.m4. Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module

解决方法:
进入php源码包目录:cd /usr/local/php-5.6.25/ext/openssl
执行命令: cp ./config0.m4 ./config.m4 即可

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读