CentOS: Enabling GD Support in PHP Installation

PhpLinuxCakephpGdCentos

Php Problem Overview


How do I go about enabling GD Support in a CentOS Installation?

Php Solutions


Solution 1 - Php

The thing that did the trick for me eventually was:

yum install gd gd-devel php-gd

and then restart apache:

service httpd restart

Solution 2 - Php

  1. You need to find a repo that offers a GD lib matching your current php version. I've had great success using Remi Collet's repo for this purpose. In fact, I used it yesterday to update my php install to the latest 5.4.0RC6 version on my CentOS6 box.
  2. Once you've setup the repo it's a simple matter of running sudo yum install php-gd
  3. Of course, the usual things apply: make sure you restart apache after installing, etc.

Solution 3 - Php

With CentOS 6.5+ and PHP 5.5:

yum install php55u-gd
service httpd restart

If you get an error like: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0, it could be because you don't have a swap file. I suggest you take a look at the tutorial mentioned in this answer: https://stackoverflow.com/a/20275282/828366

Tutorial: https://www.digitalocean.com/community/articles/how-to-add-swap-on-centos-6

Solution 4 - Php

CentOs 6.5+ & PHP 5.6:

sudo yum install php56-gd

service httpd restart

Solution 5 - Php

Put the command

yum install php-gd

and restart the server (httpd, nginx, etc)

service httpd restart

Solution 6 - Php

For PHP7 on CentOS or EC2 Linux AMI:

sudo yum install php70-gd

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAKKAwebView Question on Stackoverflow
Solution 1 - PhpNir AlfasiView Answer on Stackoverflow
Solution 2 - PhprdlowreyView Answer on Stackoverflow
Solution 3 - PhpFrancesco CasulaView Answer on Stackoverflow
Solution 4 - PhpBurak KeskinView Answer on Stackoverflow
Solution 5 - PhpIvan FretesView Answer on Stackoverflow
Solution 6 - PhpAdam WinterView Answer on Stackoverflow