PHP GD库已安装,但在CentOS 6.4上不起作用 [英] PHP GD-library installed but not functioning on CentOS 6.4

查看:335
本文介绍了PHP GD库已安装,但在CentOS 6.4上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从remi repo安装了php 5.5.6,bun phpinfo()显示没有GD库,并且gd_info()函数不存在.

I've installed php 5.5.6 from remi repo, bun phpinfo() shows no GD library and gd_info() function does not exist.

/etc/php.d/gd.ini中启用了扩展名,但仍然没有启用.

Extension is enabled in /etc/php.d/gd.ini, but still nothing.

我也尝试过重新安装php-gd库,并且成功重新安装了它,但一切都保持了以前的状态.

I've also tried to reinstall php-gd library and it reinstalled successfuly but everything remained as it was before.

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!

此后,我重新启动了服务器,但没有任何改变.

After that I restarted server, but that made no change.

gd.ini文件中仍启用扩展名.

Extension is still enabled in gd.ini file.

文件gd.so存在于/usr/lib64/php/modules中.

但是有一个大问题(我认为是原因):从控制台启动php脚本时,我得到警告:

But there is one big problem (I think that is the reason): when starting php scripts from console, I get warning:

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 ....

Than I tried to reinstall libvpx, restarted server and again - no change: the same php warning unable to load library ....

请帮忙-这个问题使我发疯:(

Please, help - this problem drives me crazy :(

推荐答案

在Internet上长时间搜索(最近几天我尝试了很多次,但最后一次尝试了),我找到了解决方案,但该解决方案与之无关到GD,PHP或其任何库.

After long search on the Internet (I made many attemps last days, but the last one was successfull) I've found the solution, and it was not related to GD, PHP or any of its libraries.

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

My VPS has 1Gb or RAM, 450MB is free. But it turned out that memory is not the only thing GD requires :) It wanted SWAP file!

我遵循了这些说明-如何添加在CentOS 6上进行交换,并添加了1GB的SWAP文件.启用后-一切开始起作用!不再有烦人的错误:)

I followed these instructions - How to add swap on CentOS 6 and added 1GB SWAP file. After enabling it - everything started to function! And no more annoying errors :)

这篇关于PHP GD库已安装,但在CentOS 6.4上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆