PHP添加GD库支持的步骤详解

php中文网
发布: 2016-07-25 08:55:14
原创
1036人浏览过
  1. [root@jbxue ~]# rpm -qa | grep zlib
  2. zlib-1.2.1.2-1.2
  3. zlib-devel-1.2.1.2-1.2
  4. You have new mail in /var/spool/mail/root
复制代码

不存在的话,请手动下载编译:http://ishare.iask.sina.com.cn/f/15275772.html

  1. tar zxvf zlib-1.2.2.tar.gz
  2. cd zlib-1.2.2
  3. ./configure
  4. make
  5. make install
复制代码

2,安装libpng http://sourceforge.net/projects/libpng/

  1. tar zxvf libpng-1.4.2.tar.tar
  2. cd libpng-1.4.2
  3. ./configure
  4. make
  5. make install
复制代码

3.安装freetype http://sourceforge.net/projects/freetype/

  1. tar zxvf freetype-2.3.12.tar.gz

  2. cd freetype-2.3.12
  3. ./configure

  4. make
  5. make install
复制代码

4,安装Jpeg http://www.ijg.org/

  1. tar zxvf jpegsrc.v8b.tar.gz

  2. cd jpeg-8b/
  3. ./configure --enable-shared

  4. make
  5. make test
  6. make install
复制代码

注意,这里configure一定要带--enable-shared参数,不然,不会生成共享库。

立即学习PHP免费学习笔记(深入)”;

5,安装GD https://bitbucket.org/pierrejoye/gd-libgd/downloads

  1. tar zxvf gd-2.0.33.tar.gz

  2. cd gd-2.0.33
  3. ./configure --with-png --with-freetype --with-jpeg
  4. make

  5. make install
复制代码

6,安装PHP php-5.2.11.tar.gz

  1. tar zxvf php-5.2.11.tar.gz

  2. cd php-5.2.11
  3. ./configure选项见下方
  4. make

  5. make install
复制代码

注:

  1. /usr/local/include/freetype2/freetype

  2. freetype
  3. /usr/local/include/include

  4. t1lig
  5. /usr/local/include/libpng14/

  6. png
  7. /usr/local/include

  8. jpeg
  9. [root@jbxue php-5.2.11]# ./configure --help | grep t1lib

  10. --with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required
  11. [root@jbxue php-5.2.11]# ./configure --help | grep png
  12. --with-png-dir[=DIR] GD: Set the path to libpng install prefix
  13. [root@jbxue php-5.2.11]# ./configure --help | grep jpeg
  14. --with-jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix
  15. [root@jbxue php-5.2.11]# ./configure --help | grep freetype
  16. --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix
  17. [root@jbxue php-5.2.11]#
  18. ./configure --prefix=/opt/php5 --with-apxs2=/opt/apache/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/opt/php5/lib --with-gd --with-zlib --with-png-dir=/usr/local/include/libpng14/ --with-jpeg-dir=/usr/local/include --with-freetype-dir=/usr/local/include/freetype2/freetype (--with-t1lib --with-t1lib-dir=/usr/local/include/include)

复制代码

最后只有T1Lib Support没有启用。

GD库支持最终如下:

  1. Listen 81

  2. #
  3. # Dynamic Shared Object (DSO) Support
  4. #
  5. # To be able to use the functionality of a module which was built as a DSO you
  6. # have to place corresponding `LoadModule' lines at this location so the
  7. # directives contained in it are actually available _before_ they are used.
  8. # Statically compiled modules (those listed by `httpd -l') do not need
  9. # to be loaded here.
  10. #
  11. # Example:
  12. # LoadModule foo_module modules/mod_foo.so
  13. LoadModule php5_module modules/libphp5.so
  14. AddType application/x-httpd-php .php

  15. AddType application/x-httpd-php-source .phps
  16. #
复制代码

在htdocs目录中创建测试文件info.php:

  1. [root@jbxue apache]# cat htdocs/info.php
  2. echo phpinfo();
  3. ?>
复制代码

然后,在浏览器中访问该文件,可查询GD库支持的情况。



PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号