How to enable GD2 Library for PHP in Windows

Introduction

In this example you will see how to enable GD2 library for PHP in Windows operating System. The GD2 library is an image library used for image processing, such as, resize, crop, watermark etc. You can find more information on this here.

Prerequisites

PHP 7.3.5, Windows Operating System

Enabling GD2 Library

Go through the following steps in order to enable GD2 library for PHP in Windows.

  1. Make sure php_gd2.dll is present under your PHP installation’s ext directory. For example, if you have installed PHP under C drive, then your ext directory would be C:\<php installation directory>\ext.
  2. If the above dll file does not exist in your PHP’s ext directory then you can download it by searching in Google with the name php_gd2.dll. Put the downloaded dll file under the PHP’s ext directory.
  3. Now open you php.ini file (location: C:\<php installation directory>\ php.ini) and make an entry extension=php_gd2.dll into this file. Make sure the entry does not exist, otherwise GD2 library already enabled for your PHP.
  4. Now if your HTTP server (Apache or IIS or any other server) is already running then you need to stop and start to reflect the changes.

That’s all. Thanks for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *