ItGo.me Focus on IT Recommend

Home > linux - CentOS: Enabling GD Support in PHP Installation

linux - CentOS: Enabling GD Support in PHP Installation

2020腾讯云双十一活动,全年最低!!!(领取3500元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1074

【阿里云】双十一活动,全年抄底价,限时3天!(老用户也有),
入口地址https://www.aliyun.com/1111/home

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

php linux cakephp gd centos
|
  this question
asked Jan 26 '12 at 20:35 Andre S 2,449 3 20 46 9   better on serverfault –  smparkes Jan 26 '12 at 20:37

 | 

4 Answers
4

---Accepted---Accepted---Accepted---

The thing that did the trick for me eventually was:

yum install gd gd-devel php-gd

and then restart apache:

service httpd restart

|
  this answer
edited Jan 4 '13 at 17:14 answered Aug 19 '12 at 6:59 alfasin 34.6k 8 41 76      works like a charm! –  Aris Feb 21 '14 at 9:20      Yes, this works perfectly on CentOS release 6.5. The "phpinfo" page says that PHP has originally compiled without gd ('--without-gd') but also dumps a section about the now-present "gd". –  David Tonhofer Mar 27 '14 at 13:05 1   Make sure that you are using the right php package. For example, in my case, I was using php56w, so I needed to use php56w-gd. –  Evan Donovan Dec 6 '16 at 21:51 1   Thanks for that clarification @alfasin - I was not the person who did the upgrade of our PHP to 5.6, so I'm not sure why they used the php56w package. I just wanted to add that as a comment though in case anyone else gets dependency resolution errors. –  Evan Donovan Dec 7 '16 at 19:11 1   wow thank you. great answer. –  Buk Lau Jan 10 at 5:19  |  show more comments
  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.

|
  this answer
answered Jan 26 '12 at 20:39 rdlowrey 24.7k 8 58 87      If you have NginX, no need to restart! Apparently you need php-gd for WordPress "edit media" wordpress.org/support/topic/edit-media-not-working –  PJ Brunet Mar 26 '15 at 22:16

 | 

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: http://stackoverflow.com/a/20275282/828366

Recommend:php - Install GD library and freetype on Linux

I'm new to this kind of stuffs, How can I install GD library and freetype in Linux php linux ubuntu gd freetype
  |
  this question edited Oct 14 '14 at 7:34 Alireza Fallah 3,627 3 20 45 asked Jan 19 '14 at 11:26 C A Mc 169 1 2

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


|
  this answer
edited Oct 7 '15 at 8:58 answered Apr 10 '14 at 9:57 Francesco Casula 9,096 5 63 82

 | 

CentOs 6.5+ & PHP 5.6:

sudo yum install php56-gd

service httpd restart

|
  this answer
answered Jun 30 '16 at 7:44 Burak Keskin 37 4

 | 

Recommend:linux - Can't install php-gd and freetype with yum on centos

ike this one Install GD library and freetype on Linux But I'm still having no luck.. [root@media modules]# sudo yum install php-gd Loaded plugins: fastestmirror, priorities, replace, security Setting up Install Process Loadi

------splitte line----------------------------