aws, amazon linux 2,

How to Install PHP GD on Amazon Linux 2

Feb 05, 2023 · 1 min read · Post a comment

If you need to create or do some stuff with images in PHP, it can be done through the GD library. Here I will show you how to install PHP GD on Amazon Linux 2.

Prerequisites

  • Amazon Linux 2
  • sudo privileges
  • PHP installed

Install PHP GD on Amazon Linux 2

Step 1. Enable the desired PHP version.

sudo amazon-linux-extras enable php{version}

Step 2. Install php-gd.

sudo yum clean metadata
sudo yum install php-gd

Step 3. Restart your web server service.

Step 4. Create the phpinfo file.

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

Step 5. Verify the installation.

http://server_ip/info.php

Conclusion

Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.