PHP8 GD activate after installation. GD doesn’t get activated by default. Not even a reboot after installation will activate it. So how do we do it?
In this example I have used Debian 11 to verify. But most newer Debian based distros should be the same. And PHP8.0 is used. Any PHP8 GD should also be done like this.
Disclaimer! If you are not local at the actual computer you are trying to activate gd, just change the localhost to appropriate address. And if you are using a PHP version different from 8.0, just change to the correct version in the commands you are issuing.
Open Terminal and then open the php config file.
sudo nano /etc/php/8.0/apache2/php.ini
Within the php.ini
file, search for the following line:
;extension=gd
Remove the semicolon so you have
extension=gd
Save the changes by pressing Ctrl + O
, then exit the editor by pressing Ctrl + X
.
Restart Apache for the changes to take effect by executing the following command:
sudo systemctl restart apache2
To verify that the gd
extension is now active, create a PHP file with the following content:
<?php
phpinfo();
?>
Save the file as phpinfo.php
.
Move the PHP file to the web server’s document root folder:
sudo mv phpinfo.php /var/www/html/
Open a web browser and access the following URL:
http://localhost/phpinfo.php
This will display the PHP information page. Search for “gd” on the page, and if you find relevant information about the GD extension, it means the php8.0-gd
extension is now active.
By following these steps, you should be able to activate the php8.0-gd
extension in Debian 11.
PHP8 GD Manual
My PHP Archive