How to Install GD for PHP on CentOS 6

From Acenet Knowledgebase
Jump to navigation Jump to search

GD is a graphics library available for PHP. It gives PHP the ability to create GIF, PNG, JPEG, WBMP, and XPM image formats. GD can even output image streams directly to a browser. On CentOS 6, GD is available as an RPM and can easily be installed with yum.

Installing GD

To install GD on CentOS 6, simply run:

<syntaxhighlight lang="bash">yum install gd-php</syntaxhighlight>

Restart your Web Server

After installing GD, restart your web server. Assuming you're running Apache, you can run:

<syntaxhighlight lang="bash">/etc/init.d/httpd restart</syntaxhighlight>

Confirm GD is Installed

You can list available PHP modules to confirm GD was successfully installed:

<syntaxhighlight lang="bash">php -m | grep -i gd</syntaxhighlight>

Here's example output showing GD has been installed:

<syntaxhighlight lang="bash">[root@vps ~]# php -m | grep -i gd gd </syntaxhighlight>