由 老高 发表于 2014-10-03  在 代码人生 分类

老高在一个新环境中装DEDECMS的时候发现后台验证码无法显示。直接搜索一下这个错误,有人说session错误,有的说权限错误等等,这不胡扯么!只能看源代码了,定位到文件/include/vdimgck.php。出错的函数是imagettftext(),由于织梦使用了@将错误隐去,导致这次莫名的错误。将@去掉,错误立马出现:

Fatal error: Call to undefined function imagettftext()

现在我们就明确了,出现错误的原因是PHP编译时没有加上FreeType。

解决办法:

首先编译安装FreeType,以2.4.0为例:

wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2
tar -jxf freetype-2.4.0.tar.bz2 cd reetype-2.4.0 # 安装到/usr/local/freetype ./configure --prefix=/usr/local/freetype make && make install 

下面我们重新编译PHP,加上参数--with-freetype-dir=/usr/local/freetype

./configure \
... \
... \
--with-freetype-dir=/usr/local/freetype

编译完成重启php

kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`

再GD库中找到FreeType Support说明安装成功!

需要注意的是,如果服务器freetype的版本是1.*,那么你可能需要改变编译参数为--with-ttf[=DIR],以下转自ChinaUnix论坛:

字库 配置开关
FreeType 1.x 要激活 FreeType 1.x 的支持,加上 --with-ttf[=DIR]。
FreeType 2 要激活 FreeType 2 的支持,加上 --with-freetype-dir=DIR。
T1lib 要激活 T1lib(Type 1 字体),加上 --with-t1lib[=DIR]。
本地 TrueType 字符串函数 要激活本地 TrueType 字符串函数的支持,加上 --enable-gd-native-ttf。

参考:

http://bbs.chinaunix.net/thread-610205-1-1.html

转载于:https://www.cnblogs.com/favana/p/5289037.html

Call to undefined function imagettftext()解决方法相关推荐

  1. php运行出现Call to undefined function curl_init()解决方法

    php运行出现Call to undefined function curl_init() 64位win7/8 下PHP不支持CURL 除了将PHP.ini中的;extension=php_curl. ...

  2. php 正则报错,PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法分析...

    本文实例讲述了PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法.分享给大家供大家参考,具体如下: 环境错误级别:error ...

  3. jquery报.live() is not a function的解决方法

    jquery报.live() is not a function的解决方法: jquery中的live()方法在jquery1.9及以上的版本中已被废弃了,如果使用,会抛出TypeError: $(. ...

  4. [jQuery1.9]Cannot read property ‘msie’ of undefined错误的解决方法

    [jQuery1.9]Cannot read property 'msie' of undefined错误的解决方法 原文:[jQuery1.9]Cannot read property 'msie' ...

  5. [jQuery] Cannot read property ‘msie’ of undefined错误的解决方法

    [jQuery] Cannot read property 'msie' of undefined错误的解决方法 参考文章: (1)[jQuery] Cannot read property 'msi ...

  6. Notice: Undefined offset 的解决方法

    Notice: Undefined offset 的解决方法 参考文章: (1)Notice: Undefined offset 的解决方法 (2)https://www.cnblogs.com/ha ...

  7. jquery升级到新版本报错[jQuery] Cannot read property ‘msie’ of undefined错误的解决方法...

    最近把一个项目的jQuery升级到最新版,发现有些页面报错Cannot read property 'msie' of undefined.上jQuery网站上搜了一下,原因是$.browser这个a ...

  8. “undefined reference to“ 解决方法

    最近在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似下面这样的错误: (.text+0x13): undefined reference to `func' 关于unde ...

  9. php 弹出变量,php取变量出现Notice: Undefined variable 的解决方法

    Notice: Undefined variable: email in D:\PHP5\ENOTE\ADDNOTE.PHP on line 9 Notice: Undefined variable: ...

最新文章

  1. android 开启一个定时线程_ANDROID开发中定时器的3种方法
  2. 二叉树:root==NULL和*root==NULL的区别
  3. 上分神器:训练调参与模型集成
  4. linux有关信号的FAQ
  5. windows 下借助7zip实现命令行解压缩
  6. Python进阶(三)单例设计模式
  7. MMIO与PIO区别
  8. 数论入门符号_大o符号快速入门
  9. python中的cd是什么意思_cd是什么意思 如果learnPython放在其它盘内该如果解决
  10. linux运行igv报错,IGV 哐当就不能用了,除了换台电脑还能怎么办?
  11. uni-app登陆成功跳转到首页后禁止回退到登陆页面
  12. 前端例程20211122:盐酸与氢氧化钠溶液中和pH计算工具
  13. mysql 不会丢失数据吗_讨论MySQL丢失数据的几种情况
  14. 《Android开发卷——自定义日期选择器(二)》
  15. 基于HarmonyOS分布式小游戏之你画我猜
  16. 如何进入Google工作? Google招聘流程介绍
  17. Android逻辑卷管理LVM,LINUX——LVM逻辑卷管理
  18. acrh17华硕固件_真香选择—华硕rt-acrh17,不止稳定……
  19. 幸运盒子幸运砸金蛋微信盲盒游戏源码
  20. sql server 2008创建修改sa用户密码

热门文章

  1. Exchange Server 2013系统要求
  2. python坐标图设计_python 三维坐标图
  3. java中文乱码decode_JAVA中文字符乱码解决详解
  4. 快捷键关机电脑_技巧 | 如何知道电脑多久没关机?一个命令就行嘞!
  5. 如何连接文档服务器,如何连接服务器地址
  6. c 语言 移位四舍五入,关于C 语言中的四舍五入问题
  7. mysql横向扩展_高可用MySQL学习笔记-面向横向扩展的MYSQL复制
  8. c语言变量定义数组,C语言中数组的定义和使用
  9. mysql的基本数据类型总结_Mysql数据类型的详细总结
  10. 如何验证登录oracle,Oracle登录验证方式详解