PHP GD library is used to created images on the fly. This library is not installed or activated by default when you first install Apache on Linux. But GD library is used widely while developing websites. For eg. if you want to create a captcha image for a registration form, then you are going to use image functions, which are found in GD library in PHP.

So in this blog I am going to tell you

How to add GD library in Apache?

Ideally you need to compile this package of PHP before you could install. However, Ubuntu or Debian flavors of Linux comes with this package. So all we need to do is – Install it, simple ?

So install PHP GD library on Ubuntu just type the following command –

# sudo apt-get install php5-gd

It will as for Y/n , just say Y and let it install. After installation is done, you have to restart your server before you can use it. So to restart Apache server, type the following command –

# sudo /etc/init.d/apache2 restart

or

# sudo apache2ctl restart

That’s all to install PHP GD library. Now you can run your image related script without any problem.

 

Stay Digified !!
Sachin Khosla

Share this post: