• linux 下 php+gd2+freetype+jpeg+png+zlib编译安装


    事件缘起:discuz后台开启中文验证码提示说不支持freetype,但freetype貌似是需要gd2调用生效的。

    于是安装gd2,安装gd2的时候顺带安装了jpeg,png,zlib

    所需要的安装包都已经放置在百度云盘,下载链接http://pan.baidu.com/share/link?shareid=1837459297&uk=1778705955

    接下来就是配置步骤:

    1、安装zlib

    tar xf zlib-1.2.7.tar.gz

    cd zlib-1.2.7
    ./configure --prefix=/usr/local/zlib
    make
    make install
     
    2、安装 jpeg
    tar xf jpegsrc.v9a.tar.gz
    cd jpeg-9a
    ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
    make
    make install
     
    3、安装 libpng
    tar xf libpng-1.6.12.tar.gz
    cd libpng-1.6.12
    ./configure --prefix=/usr/local/png
    make
    make install 
     
    4、安装freetype
    tar xf freetype-2.5.3.tar.gz
    cd freetype-2.5.3
    ./configure --prefix=/usr/local/freetype
    make
    make install 
     
    5、安装gd2
    tar xf libgd-2.1.0.gz
    cd libgd-2.1.0
    ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg/ --with-png=/usr/local/png/ --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/
    make
    make install
    (注,版本这里必须>=2.1.0,否则用php-5.6.0会报错,可能老版本的php不会报错)
    6、集成PHP GD扩展到PHP里
    本来想在[php目录]/ext/gd内使用phpize扩展gd模块的,但是提示没有config.m4文件
    所以只能重新编译php
    卸载所有跟php相关的包:
    rpm -qa|grep php
    使用rpm -e 加包名
    rpm -e php-4.3.9-3.15 
    重新编译php:
    tar xf php-5.6.0.tar.gz
    cd php-5.6.0
    ./configure --prefix=/usr/local/php-5.6.0 --with-config-file-path=/usr/local/php-5.6.0/etc --with-config-file-scan-dir=/usr/local/php-5.6.0/etc/conf.d --enable-fpm --with-pear --with-curl --with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --with-freetype-dir=/usr/local/freetype --with-zlib-dir=/usr/local/zlib --with-iconv --with-mcrypt --with-mhash --with-zlib --with-xmlrpc --with-xsl --with-openssl --with-mysql --with-mysqli --with-pdo-mysql --with-bz2 --with-gettext --with-xpm-dir=/usr/lib64/
    make && make install
     
    最后,重启php-fpm以重载php:
    php-fpm 关闭:
    kill -INT `cat /usr/local/php-5.6.0/var/run/php-fpm.pid`
    php-fpm 重启:
    kill -USR2 `cat /usr/local/php-5.6.0/var/run/php-fpm.pid`
    ,刷新phpinfo,看到有支持相关模块的话就是成功了。
  • 相关阅读:
    写代码如坐禅:你是哪一类程序员
    开发企业应用系统需要掌握的知识技能(转)
    (转)谈谈多线程的思维方式
    深入理解JavaScript定时机制
    (转)javascritp对fckeditor编辑器操作
    JavaScript异步编程的Promise模式
    (转)jquery调WCF
    (转)《代码大全》学习笔记:第10,11,12,13章 关于变量的使用,命名等
    编程:是一门艺术(转)
    禅修程序员十诫(转)
  • 原文地址:https://www.cnblogs.com/nickqian/p/3974210.html
Copyright © 2020-2023  润新知