posted by Old high in 2014-10-03 in Code life classification
Old Gao in a new environment when the DEDECMS found that the background verification code cannot be displayed. Direct search for this error, some people say that the session error, and some say permission error, and so on, this is not nonsense! can only see the source code, to locate the file /include/vdimgck.php
. The function of error is that because of the use of the dream of the mistake of the imagettftext()
@
hidden, leading to this inexplicable error. To be @
removed, the error appears immediately:
Fatal error:call to undefined function imagettftext ()
Now we are clear that the reason for the error is that PHP was compiled without adding freetype.
Workaround:
First compile and install FreeType, take 2.4.0 as an example:
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2tar -jxf freetype-2.4.0.tar.bz2cd reetype-2.4.0# 安装到/usr/local/freetype./configure --prefix=/usr/local/freetypemake && make install
Here we recompile PHP, plus the parameters--with-freetype-dir=/usr/local/freetype
./configure \... \... \--with-freetype-dir=/usr/local/freetype
Compile to complete restart PHP
kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`
Again the GD library to find FreeType Support
instructions for installation success!
It should be noted that if the server FreeType version is 1.*, then you may need to change the compilation parameters for --with-ttf[=DIR]
the following to go from the Chinaunix forum:
Font configuration Switch
FreeType 1.x to activate FreeType 1.x support, plus--with-ttf[=dir].
FreeType 2 to activate FreeType 2 support, plus--with-freetype-dir=dir.
T1lib to activate T1lib (Type 1 font), plus--with-t1lib[=dir].
Local TrueType String functions to activate support for local TrueType string functions, plus--enable-gd-native-ttf.
Reference:
Http://bbs.chinaunix.net/thread-610205-1-1.html
The above describes the call to undefined function Imagettftext solution, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.