Sabuj Kundu 13th Jan 2013

GD Library

Logo credit: David Ross Design

Have you ever wonder about that how you can temporary (or may be permanent, too) disable the GD Library support for PHP in you Linux box? Well, here is a trick reference for you.

The Situation:
I use Ubuntu 12.04 in my development machine and use LAMP as a local web server for development purpose. Recently I was working in a project where GD library is a essential dependency and I had to check the behavior of the code I wrote under a server environment where GD library is not available. You may want to find the way that I did tweak and checked.

A Solution:

Step 01:
Find the file: /etc/php5/apache2/conf.d/gd.ini and open it with root privilege in gedit (or any other text editor)

Command:
sudo gedit /etc/php5/apache2/conf.d/gd.ini

Step 02:
Put a semicolon in front of the line says, extension=gd.so make it looks like:

; configuration for php GD module
;extension=gd.so

Then save and close the file.

Step 03:
Now reload the apache2 configuration

Command:
sudo service apache2 reload

And now you have GD Library is installed but disabled in your system.

“The Reverse Sweep”
To enable it back, just follow the entire process except uncommenting the 2nd line in step two instead of commenting with a semicolon.

Peace Out! :)