![CentOS 5 上的 PHP 5.4 - GD 无法正常工作](https://linux22.com/image/593700/CentOS%205%20%E4%B8%8A%E7%9A%84%20PHP%205.4%20-%20GD%20%E6%97%A0%E6%B3%95%E6%AD%A3%E5%B8%B8%E5%B7%A5%E4%BD%9C.png)
我安装的是 PHP 5.4:
rpm -qa | grep php
php-common-5.4.6-1.el5.remi
php-5.4.6-1.el5.remi
php-cli-5.4.6-1.el5.remi
这是我的 php-m 输出:
php -m
PHP Warning: PHP Startup: curl: Unable to initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: fileinfo: Unable to initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: json: Unable to initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/extensions/no-debug-non-zts-20060613/phar.so' - /usr/local/lib/extensions/no-debug-non-zts-20060613/phar.so: undefined symbol: zend_resolve_path in Unknown on line 0
PHP Warning: PHP Startup: zip: Unable to initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
[PHP Modules]
ctype
curl
date
dom
filter
ftp
gd
hash
iconv
json
libxml
mcrypt
mysql
mysqli
openssl
pcre
PDO
pdo_sqlite
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
php.ini文件:
[gd]
; Tell the jpeg decode to ignore warnings and try to create
; a gd image. The warning will then be displayed as notices
; disabled by default
; http://php.net/gd.jpeg-ignore-warning
;gd.jpeg_ignore_warning = 0
extension=gd.so
我在 /usr/local/lib/extensions/no-debug-non-zts-20060613/ 中有一个 gd.so,权限为 777。
我已经重启了 apache。Php 可以工作,但 gd 不行。
谢谢您的任何意见!
Available Packages
php-gd.i386 5.1.6-39.el5_8 updates
[root@ser ~]# yum install php-gd.i386
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirror.symnds.com
* extras: mirror.cogentco.com
* updates: mirror.ash.fastserv.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-gd.i386 0:5.1.6-39.el5_8 set to be updated
--> Processing Dependency: php-common = 5.1.6-39.el5_8 for package: php-gd
--> Finished Dependency Resolution
php-gd-5.1.6-39.el5_8.i386 from updates has depsolving problems
--> Missing Dependency: php-common = 5.1.6-39.el5_8 is needed by package php-gd-5.1.6-39.el5_8.i386 (updates)
Error: Missing Dependency: php-common = 5.1.6-39.el5_8 is needed by package php-gd-5.1.6-39.el5_8.i386 (updates)
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
答案1
在您的存储库中查找php-gd
RPM。我相信这就是您所缺少的。
更新:您可以使用 搜索可用的 RPM yum list "php-gd"
。
如果找到可用的,那么您可以使用 安装它yum install php-gd
。
答案2
看起来您正在使用 Remi 存储库。您必须禁用 CentOS Base 存储库中的 PHP 包,将以下行添加到块/etc/yum.repos.d/CentOS-Base.repo
中[updates]
:
[updates]
...
exclude=php*