【问题标题】:PHP GD-library installed but not functioning on CentOS 6.4PHP GD-library 已安装但在 CentOS 6.4 上无法运行
【发布时间】:2013-12-15 00:16:32
【问题描述】:

我已经从 remi repo 安装了 php 5.5.6,bun 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 等,请确保将其放入正确的配置中。
  • 是的,一切都已启用。但我刚刚解决了这个问题(它与 php、GD 或其他软件没有真正的关系——这是最有趣的事情)。我会在几分钟内添加问题的答案并附上解释。

标签: php centos6 php-gd


【解决方案1】:

在网上找了很久(前几天试了很多次,最后一次都成功了)我找到了解决办法,和GD、PHP或者它的任何库都没有关系。

我的 VPS 有 1Gb 或 RAM,450MB 是免费的。但事实证明,内存并不是 GD 唯一需要的东西 :) 它想要 SWAP 文件!

我按照这些说明 - How to add swap on CentOS 6 并添加了 1GB SWAP 文件。启用后 - 一切都开始运作!不再有烦人的错误:)

【讨论】:

  • 非常感谢!我只是碰巧被同样的错误所困扰。
  • 您的解决方案如何修复指出该函数不存在的错误消息?我看不出它们之间有什么关系。
  • 也受到此错误的困扰。没有文档说明为什么会出现此问题。很高兴我遇到了你的答案。还想补充一点,在使用 SWAP 文件和 GD 库开始工作之前,服务器需要重新启动。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-23
  • 1970-01-01
  • 2016-07-26
  • 1970-01-01
  • 1970-01-01
  • 2017-09-30
相关资源
最近更新 更多