Php

在 CentOS 上安裝 GDChart 失敗:pecl/gdchart 需要 PHP 擴展“gd”

  • December 13, 2010

有沒有人解決了在 CentOS 5.5 Linux 上安裝 GDChart 的問題(我試過 32 位和 64 位版本)?

我有:

# rpm -qa | grep -i php
php-pear-1.4.9-6.el5
php-gd-5.1.6-27.el5
php-ldap-5.1.6-27.el5
php-pgsql-5.1.6-27.el5
php-5.1.6-27.el5
php-pdo-5.1.6-27.el5
php-common-5.1.6-27.el5
php-cli-5.1.6-27.el5
php-devel-5.1.6-27.el5

而“pecl”似乎在其儲存庫中找到了 GDChart:

#  sudo pecl search GDChart
Retrieving data...0%....50%....Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest)    Local
GDChart -n/a-/(0.2.0 beta)       GDChart Based Graphing Interface

但安裝失敗:

# sudo pecl install GDChart
Failed to download pecl/GDChart within preferred state "stable",
latest release is version 0.2.0, stability "beta", use
"channel://pecl.php.net/GDChart-0.2.0" to install
Cannot initialize 'GDChart', invalid or missing package file
Package "GDChart" is not valid
install failed

好的,然後我嘗試建議的“URL”:

# sudo pecl install "channel://pecl.php.net/GDChart-0.2.0"
pecl/gdchart requires PHP extension "gd"
No valid packages found
install failed

但我確實安裝並啟用了“gd”和“php-gd”rpm:

# cat /etc/php.d/gd.ini
; Enable gd extension module
extension=gd.so

並且 phpinfo() 也顯示“gd”已啟用:

GD Support  enabled
GD Version  bundled (2.0.28 compatible)
FreeType Support  enabled
FreeType Linkage  with freetype
FreeType Version  2.2.1
GIF Read Support  enabled
GIF Create Support  enabled
JPG Support  enabled
PNG Support  enabled
WBMP Support  enabled
XBM Support  enabled 

請問有什麼建議,除了手工編譯嗎?亞歷克斯

pecl 命令在告訴你為什麼出錯時很糟糕。我會重新創建你正在做的事情

wget http://pecl.php.net/get/gdchart-0.2.0.tgz
tar zxfv gdchart-0.2.0.tgz 
cd gdchart-0.2.0
phpize
./configure
make

很多東西

In file included from /home/mzupan/gdchart-0.2.0/gdchart.c:35:0:
/home/mzupan/gdchart-0.2.0/gdchart-src/gdc.h:27:16: fatal error: gd.h: No such file or directory
compilation terminated.

所以安裝 gd-devel

sudo yum install gd-devel

然後你的 pecl 安裝應該可以工作

引用自:https://serverfault.com/questions/212014