A GD introduction:
PHP's extended library of graphics processing provides a range of APIs for working with images. If the development process found that the page verification code can not be displayed, you should consider checking phpinfo (), whether the GD library is supported.
Two ideas:
Online discovery of the method of adding GD library, everywhere is downloaded separately libgd source method, for compiling LIBGD, also need to download a series of dependencies, quite troublesome. Used to play Wamp, remember that Gd.dll are PHP comes with. Guess, under Linux, through the PHP source code may be able to get the corresponding. so file. Sure enough, under the Php_src/ext really have GD source code.
Three versions: PHP 5.6.9
Four processes:
1: Compile build. So file
[Email protected] gd]# pwd #路径
/opt/php/php-5.6.9/ext/gd
[Email protected] gd]#. /.. /scripts/phpize #用phpize工具生成configure文件
Configuring for:
PHP Api version:20121113
Zend Module Api no:20121212
Zend Extension Api no:220121212
[Email protected] gd]#
[Email protected] gd]#/configure \
>--prefix= $HOME/install/php/\
>--with-php-config= $ (PHP installation path)/bin/php-config
[[email protected] gd]# make install
... #省略其他打印
CP./.libs/gd.so/opt/php/php-5.6.9/ext/gd/modules/gd.so #目标文件生成
CP./.libs/gd.lai/opt/php/php-5.6.9/ext/gd/modules/gd.la
Path= "$PATH:/sbin" Ldconfig-n/home/lzc/lamp/php/php-5.6.9/ext/gd/modules
----------------------------------------------------------------------
Libraries has been installed in:
/home/lzc/lamp/php/php-5.6.9/ext/gd/modules
..... #省略其他打印
Installing Shared extensions:/usr/local/lib/php/extensions/no-debug-non-zts-20131212/
Installing header files:/usr/local/include/php/
[Email protected] gd]# cp/usr/local/lib/php/extensions/no-debug-non-zts-20121312/gd.so/opt/php/lib/php/ Extensions/no-debug-non-zts-20121312/gd.so #将文件copy到自己的php安装路径下
2: Edit php.ini, add extension
Extension=/opt/php/lib/php/extensions/no-debug-non-zts-20131212/gd.so
PHP Add GD