Enabling GD Support for PHP

Enabling GD Support for PHP
Enabling GD library for PHP allows you to work with graphics, such as creating images, resizing, and editing pictures effectively. Here’s how to enable GD library both on Linux and XAMPP

Certainly! To enable GD library for PHP, follow these steps
  1. On Linux (Debian/Ubuntu):
    • Install GD library: sudo apt-get install php-gd (for Debian/Ubuntu) or sudo yum install php-gd (for CentOS/RHEL).
    • Edit php.ini by opening it with a text editor: sudo nano /etc/php/7.x/apache2/php.ini or sudo nano /etc/php/7.x/cli/php.ini.
    • Add or uncomment the line extension=gd (remove the semicolon if present).
    • Restart Apache: sudo service apache2 restart or Nginx: sudo service nginx restart.
    • Verify GD is enabled by creating a phpinfo.php file with the code <?php phpinfo(); ?> and searching for “gd” in your browser.
  2. On XAMPP (Windows):

    • Open php.ini (usually located at C:\xampp\php\php.ini).
    • Search for the line with ; extension=gd and remove the semicolon to enable GD library: extension=gd.
    • Save the file.
    • Restart Apache in XAMPP Control Panel.
    • Verify GD is enabled by creating a phpinfo.php file in the htdocs directory (usually C:\xampp\htdocs\) with the same code as above.
Remember to adapt these steps based on your specific system configuration!
0SHAREFacebookLINE it!