我从Remi仓库安装了php 5.5.6,但 phpinfo()
没有显示GD库和 gd_info()
函数不存在。
扩展在/etc/php.d/gd.ini
中启用,但仍然没有改变。
我还尝试重新安装php-gd库,并且重新安装成功,但是一切都和以前一样。
yum --enablerepo=remi,remi-php55 reinstall php-gd
Loaded plugins: fastestmirror
Setting up Reinstall Process
Loading mirror speeds from cached hostfile
* base: mirrors.supportex.net
* epel: mirror.muntinternet.net
* extras: mirrors.supportex.net
* remi: mirror.1000mbps.com
* remi-php55: mirror.1000mbps.com
* rpmforge: mirror.nl.leaseweb.net
* updates: mirror.muntinternet.net
Resolving Dependencies
--> Running transaction check
---> Package php-gd.x86_64 0:5.5.6-1.el6.remi will be reinstalled
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Reinstalling:
php-gd x86_64 5.5.6-1.el6.remi remi-php55 66 k
Transaction Summary
====================================================================================================================================
Reinstall 1 Package(s)
Total download size: 66 k
Installed size: 228 k
Is this ok [y/N]: y
Downloading Packages:
php-gd-5.5.6-1.el6.remi.x86_64.rpm | 66 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-gd-5.5.6-1.el6.remi.x86_64 1/1
Verifying : php-gd-5.5.6-1.el6.remi.x86_64 1/1
Installed:
php-gd.x86_64 0:5.5.6-1.el6.remi
Complete!
之后我重新启动了服务器,但没有任何改变。
扩展仍然在gd.ini
文件中启用。
文件gd.so
存在于/usr/lib64/php/modules
中。
但是有一个大问题(我认为这就是原因):当从控制台启动php脚本时,我会收到警告:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - libvpx.so.0: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0
然后我尝试重新安装libvpx
,重新启动服务器,但仍然没有改变:相同的php警告unable to load library ....
请帮忙解决 - 这个问题让我疯了 :(
php -i | grep gd
或查找phpinfo();
时,它是否已启用?根据不同的情况,有不同的 PHP 配置,例如/etc/php/apache/php.ini
、/etc/php/php5-fpm/php.ini
等,请确保将其放入正确的配置中。 - Daniel W.