编译在PHP中的freetype支持

我无法编译在PHP中的freetype支持…

我的configuration命令是:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-bcmath --enable-zip --with-zlib --with-gd --with-jpeg-dir=/usr/lib --with-mysqli --enable-mbstring --with-pdo-mysql --with-pgsql=/usr/lib/pgsql --with-freetype-dir=/usr/lib --enable-gd-native-ttf 

它运行良好(不抱怨什么),编译也成功,但最终freetype支持未启用:

 ["GD Version"]=> string(27) "bundled (2.0.34 compatible)" ["FreeType Support"]=> bool(false) ["T1Lib Support"]=> bool(false) 

/ usr / lib看起来是正确的地方寻找freetype:

 # pwd /usr/lib # ll|grep -i freetype lrwxrwxrwx 1 root root 21 Dec 10 13:35 libfreetype.so -> libfreetype.so.6.3.10 lrwxrwxrwx 1 root root 21 Dec 10 13:35 libfreetype.so.6 -> libfreetype.so.6.3.10 -rwxr-xr-x 1 root root 525448 Nov 16 17:55 libfreetype.so.6.3.10 

OS是Centos Linux 5,php版本是5.2.17。

任何提示? 谢谢!

由于这个问题是关于编译 PHP与FreeType的支持,而不是安装它,我想补充一点,以防万一有人(像我)有这个问题,需要编译一个PHP版本,不作为一个包。

  1. 首先,您需要安装FreeType库,方法是从http://freetype.org/download.html下载并编译它,或者安装操作系统提供的软件包。
  2. 第一个问题是用--with-freetype-dir指定的path不正确。 你想包含目录而不是freetype的lib目录。 在我的情况下(在CentOS v6.7上),目录是/usr/include/freetype2 。 你可以通过运行find / -name freetype2find它。
  3. 现在这个部分已经sorting了,你可以用上面确定的--with-freetype-dir参数运行./configure 。 在这个问题的情况下,完整的命令是./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-bcmath --enable-zip --with-zlib --with-gd --with-jpeg-dir=/usr/lib --with-mysqli --enable-mbstring --with-pdo-mysql --with-pgsql=/usr/lib/pgsql --with-freetype-dir=/usr/include/freetype2 --enable-gd-native-ttf
  4. 如果您之前已经编译过PHP,则需要先运行make clean 。 configuration已经改变,所有要擦除的对象都要重新编译。
  5. 运行make ,然后make install以编译PHP。
  6. 通过运行php -i或查看phpinfo();的输出来validation是否安装了FreeType phpinfo(); 。 如果使用Web服务器,则可能需要重新启动才能使更改生效。

在CentOS上,您可以使用yum并执行安装。

首先,我会执行下面的命令,看看有什么结果,然后发出yum命令来安装php-gd:

 rpm -qa | grep php yum install php-gd 

确保以root用户身份运行这些文件,以便您拥有安装许可