PHP GD-library installed but not functioning on CentOS 6.4
Asked Answered
W

1

7

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

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

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.

Extension is still enabled in gd.ini file.

File gd.so exists in /usr/lib64/php/modules.

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

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 :(

Weisler answered 28/11, 2013 at 21:24 Comment(2)
when you enter php -i | grep gd or lookup phpinfo(); is it enabled? There are different PHP configs according to the scenario e.g. /etc/php/apache/php.ini, /etc/php/php5-fpm/php.ini etc, make sure you put it into the correct config.Flotage
Yes, everything enabled. But I've just solved the problem (and it was not really related to php, GD or other software - that is the most interesting thing). I'll add answer to question in a few minutes with explanations.Weisler
W
8

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.

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!

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 :)

Weisler answered 28/11, 2013 at 21:54 Comment(3)
Oh thanks a ton! I just happened to be plagued by the very same error.Lalita
How your solution fixed that error message that said that the function didn't exist? I don't see a relation between them.Shadowy
Plagued by this error as well. No documentation on why this would be the issue. So glad I came across your answer. Also wanted to add that the server needed a reboot before the SWAP file was used and the GD library started to work.Morton

© 2022 - 2024 — McMap. All rights reserved.