Configure PHP to have GD Library support

What is the GD library? GD is an open source code library for the dynamic creation of images by programmers. GD is written in C, and “wrappers” are available for Perl, PHP and other languages. GD creates PNG, JPEG and GIF images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything else, on the fly. While not restricted to use on the web, the most common applications of GD involve website development.


Two way installation


1. Source installation


yum install php-gd

yum install gd-devel


in order to enable gd library you may edit php.ini and uncomment





You may also have to correct the extension directory setting from:

extension_dir = “./”


extension_dir = “./extensions”



2. Native Installation



./configure \

–with-apxs2=/usr/local/apache/bin/apxs \

–with-mysql=/usr/bin/mysql \

–prefix=/usr/local/apache/php \

–with-config-file-path=/usr/local/apache/php \

–enable-force-cgi-redirect \

–disable-cgi \

–with-zlib \

–with-gettext \

–with-gdbm \

–enable-zip \

–with-gd \

–with-jpeg-dir=/usr/lib/ \

–with-png-dir=/usr/lib/ \



B. make

C. make install


verfiy it by making a file phpinfo.php

vi phpinfo.php and put





restart apache and verify if gd is enabled on the page.


PHP help & guide for htaccess file configuration

.htaccess Configuration

Includes Writing module, pointing of to, and gzip compression


####Configuration for mod_rewrite used for wordpress

####Configuration to point to



RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} !^$

RewriteCond %{HTTP_HOST} !^domain\.com\ [NC]

RewriteRule ^/(.*)$1 [R=permanent,L]

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]


####Configuration for gzip compression


# compress text, html, javascript, css, xml:

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript


# Or, compress certain file types by extension:

SetOutputFilter DEFLATE


# END WordPress



Apache actually has two compression options:

mod_deflate – easier to set up and is standard.

mod_gzip – seems more powerful: you can pre-compress content.