由 老高 发表于 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. 设置sonar 界面为中文环境

    sonar 默认是英文的界面 1.下载http://repository.codehaus.org/org/codehaus/sonar-plugins/l10n/sonar-l10n-zh-plug ...

  2. 第三百零四天 how can I 坚持

    我以为我遇到了,却是痴心妄想啊.哪有那么好的事.其实也无所谓,淡定,却又有点不淡定了. 洗澡睡觉吧,明天还要上班呢. 应该摆脱这种状态. 什么都不想,放空.

  3. 第二百九十六天 how can I 坚持

    今天果真好冷,至今遇到的最冷的一天,出去一趟,脸都快要冻瘫了. 感觉自己事真的多,找个对象还这事那事的,活该单身. 好愁人啊. 今天,魏中贺来北京,本来说的要明天聚聚,可是,都不给力啊,都不知道在忙啥 ...

  4. homework07

    我阅读的: http://www.cnblogs.com/zhuyp1015/category/370450.html http://blog.csdn.net/hzyong_c/article/de ...

  5. Spring JdbcTemplate batchUpdate() example

    In some cases, you may required to insert a batch of records into database in one shot. If you call ...

  6. ASP获取json天气信息

    ASP代码(ASP获取页面源码方法,有编码.超时时间参数,处理了乱码.超时的问题): Function GetHttpPage(HttpUrl) Then GetHttpPage="$Fal ...

  7. android开发教程(八)——环境搭建之java-ndk

    目录 android ndk是android用于开发本地代码的开发工具包.它提供C/C++交叉编译工具.android内核.驱动.已有的C/C++代码,都需要ndk来支持开发. 目前支持以下平台:ar ...

  8. do{...}while(0)的作用

    不是为了循环的while. 1.用于宏定义,保证宏一定按照想要的方式执行. #define   foo(x)     start(x); end(x) if(flag) foo(x); 扩展以后的结果 ...

  9. Js面向对象和数据类型内存分配(转)

    一 Js基本数据类型以及内存情况 1 Undefined Undefined类型只有一个值undefined,在使用了声明但未初始化的变量的时候,这个变量值就是undefined 1 var hi; ...

  10. java中关于类的封装与继承,this、super关键字的使用

    原创作品,可以转载,但是请标注出处地址http://www.cnblogs.com/V1haoge/p/5454849.html. this关键字: this代表当前对象,它有以下几种用途: 1.本类 ...