由 老高 发表于 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

 

Call to undefined function imagettftext()解决方法的更多相关文章

  1. Fatal error: Call to undefined function imagettftext()解决办法

    Fatal error: Call to undefined function imagettftext()解决办法   我的问题是php编译安装时指定了gd的目录,其实不用指定.就可以了 博客分类: ...

  2. Call to undefined function curl_init()解决方法

    今天在使用php中的 curl 扩展时 在开启

  3. undefined function mysql_connect()解决方法

    在配置apache+php+mysql后,打开一个php网页文件正常,但是php网页中连接数据库时,出现以下提示: Fatal error: Call to undefined function my ...

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

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

  5. 在已经编译安装好php7场景下,install gd库 with free-type (解决Call to undefined function imagettftext())

    在已经编译安装好php7场景下,install gd库 with free-type (解决Call to undefined function   imagettftext()) install g ...

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

    测试代码出现报错Call to undefined function imagettftext(),发现是gd库出现了问题 通过phpInfo()查看 gd库已经开启,但是里边没有freeType 和 ...

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

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

  8. Mac下Call to undefined function imagettftext() 解决方案

    文章转载至Mac下Call to undefined function imagettftext()终极解决方案 安装了一套onethink程序准备调试,结果在登录页面发现验证码无法显示,单独访问验证 ...

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

    原文:[jQuery1.9]Cannot read property 'msie' of undefined错误的解决方法 $.browser在jQuery1.9里被删除了,所以项目的js代码里用到$ ...

随机推荐

  1. Java处理InterruptedException异常小结

    对于InterruptedException,一种常见的处理方式是捕捉它,然后什么也不做(或者记录下它,不过这也好不到哪去).不幸的是,这种方法忽略了这样一个事实:这期间可能发生中断,而中断可能导致应 ...

  2. ProtoBuffer 简单例子

    最近学了一下protobuf,写了一个简单的例子,如下: person.proto文件 message Person{ required string name = 1; required int32 ...

  3. 现代程序设计——homework-10

    设计 对于MVC我的理解是这样的,V是台显示器,注意仅仅是一台比显示器普通显示器多几个按钮,用户按什么,按了什么该干什么都不用操心:M是实体的软件抽象,假设实体可以但不执行,我就可以一步一步走,实体可 ...

  4. UVALive 7456 Least Crucial Node (并查集)

    Least Crucial Node 题目链接: http://acm.hust.edu.cn/vjudge/contest/127401#problem/C Description http://7 ...

  5. codeforces 624A Save Luke(水题)

    A. Save Luke time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  6. 写的一个判断注册Email是否是个人邮件,而不是公司邮件的方法

    以下这个方法其实也不是很全面,它只判断了hotmail, gmail和yahoo 如果你还需要加上其他认为是私人Email的Email, 只要按照同样的方法自己加上就可以了 Public void C ...

  7. UVa 1252 Twenty Questions (状压DP+记忆化搜索)

    题意:有n件物品,每件物品有m个特征,可以对特征进行询问,询问的结果是得知某个物体是否含有该特征,要把所有的物品区分出来(n个物品的特征都互不相同), 最小需要多少次询问? 析:我们假设心中想的那个物 ...

  8. Windows下sqlmap的使用_01

    环境:win8.1 64位    一.下载 首先,需下载SqlMap以及适用于Windows系统的Python.下载地址如下:   1.1.SqlMap下载地址:https://github.com/ ...

  9. mysql case when 条件过滤

    [1].[代码] 使用CASE WHEN进行字符串替换处理 跳至 [1] [2] [3] [4] ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 ...

  10. javascript:history.go(-1);

    history是你浏览过的网页的url(简单的说就是网址)的集合,也就是你的浏览器里的那个历史记录.它在js里是一个内置对象,就跟document一样,它有自己的方法,go就是其中一个. 这个方法的参 ...