No package php8 0 gd available

We wanted to install gd library extension under PHP 8.0.9 on a Linux Debian 10.10 VM Server with apache2 webserver by using the PuTTY console with root access. We tried installing it 2 times but we always end up with the same faulty result. It seems like the "gd.so" file which we assume should be created under "etc/php/8.0/extension/" is missing every time, but that is just our assumption. Here is how we installed PHP a while ago:

apt install php8.0

We tried installing gd library with the following command after running apt update and apt upgrade

apt-get install php8.0-gd

The installation runs smoothly but the result is unsatisfactory. As you can see on the screenshots below, it looks like it has been installed correctly, but even after rebooting the complete virtual machine the "phpinfo(INFO_ALL);" does not have gd enabled and none of the libraries functions work.

PHP Version

Installed Modules (extensions)

PHP info states it is enabled and running

Potentially missing gd.so file under etc/php/8.0/extension/ ?

The apache2 logfile under var/log/apache2 has no entries regarding this problem. The /etc/php/8.0/apache2/conf.d/20-gd.ini is mentioned in the phpinfo() header under "Additional .ini files parsed". The content of the file has one line:

extension=gd.so

The same content can be found within the mods-available/gd.ini and the cli/conf.d/@20-gd-ini.

If you need any additional information that can possibly be of any help to sort out what went wrong, please let me know.

Package: php8.0-gd (8.0.8-1ubuntu0.4 and others) [security]

GD module for PHP

  • depends
  • recommends
  • suggests
  • enhances
  • dep: libc6 (>= 2.17) [arm64, ppc64el]GNU C Library: Shared libraries dep: libc6 (>= 2.4) [not arm64, ppc64el]
  • dep: libgd3 (>= 2.1.1) GD Graphics Library
  • dep: php-common (>= 1:81~) Common files for PHP packages
  • dep: php8.0-common (= 8.0.8-1build1) [not amd64, i386]documentation, examples and common module for PHP dep: php8.0-common (= 8.0.8-1ubuntu0.4) [amd64, i386]
  • dep: ucfUpdate Configuration File(s): preserve user changes to config files

While installing a maatwebsite/excel package on the server it gives below error. Code is deploying using CircleCI. I checked on the server gd extension is already enabled. Can anyone help me on this please?

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for phpoffice/phpspreadsheet 1.14.1 -> satisfiable by phpoffice/phpspreadsheet[1.14.1].
- phpoffice/phpspreadsheet 1.14.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
Problem 2
- phpoffice/phpspreadsheet 1.14.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- maatwebsite/excel 3.1.21 requires phpoffice/phpspreadsheet ^1.14 -> satisfiable by phpoffice/phpspreadsheet[1.14.1].
- Installation request for maatwebsite/excel 3.1.21 -> satisfiable by maatwebsite/excel[3.1.21].

To enable extensions, verify that they are enabled in your .ini files:
-
- /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
- /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
- /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Exited with code exit status 2
CircleCI received exit code 2

PHP 8.0 brings several new features and improvements in performance, syntax, security, and stability. Installing PHP 8.0 on just about any sort of server/development setup is made easy with pre-compiled packages available in all currently supported Debian and Ubuntu versions.

Extensions and Dependency Changes in PHP 8.0

Despite the massive amount of changes, there are not many changes in PHP 8.0 in its dependencies and extension structure.

  1. JSON extension is now always available, and there is no compile flag to exclude it. This means there is no need to explicitly install php-json packages anymore.
  2. xmlrpc extension is moved to PECL with good reasons. Software repositories mentioned in this post does not include xmlrpc extension for PHP 8.0.

In addition, the GD extension has its name changed from php_gd2.dll to php_gd.dll in Windows that will be covered in a separate article.

INI changes in PHP 8.0

There are few INI file changes as well.

  1. Assertions throw exceptions by default - (assert.exception=1)
  2. Default error display is set to E_ALL - (error_reporting=-1)
  3. Startup errors are displayed by default - (display_startup_errors=1)

Due to new features and changes in PHP 8.0,

  • The new JIT feature in PHP 8.0 adds several new INI directives.
  • zend.exception_string_param_max_len INI setting due to Configurable exception stack trace string length

Installing PHP 8.0 on Ubuntu and Debian is made easy by the great efforts of Ondřej Surý. He maintains a PHP PPA that contains PHP 8.0 and several popular PECL extensions ready to install on any current Debian/Ubuntu system.


1. List existing PHP packages

If you are updating from an existing PHP version to 8.0, it's important to get a list of existing PHP packages. Albeit the small extension changes, installing the PHP 8.0 counterpart packages is the easiest way to make sure the upgrade is smooth and covers the same packages from the current PHP version.

dpkg -l | grep php | tee packages.txt

This command will list all the packages containing name php, and writes it to a file named packages.txt, which can be referred anytime.

2. Add ondrej/php PPA

Ubuntu

sudo add-apt-repository ppa:ondrej/php # Press enter when prompted.
sudo apt-get update

Debian

sudo apt install apt-transport-https lsb-release ca-certificates wget -y
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg 
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update

Steps above will add the PPA as a source of packages, that contains all PHP packages and their dependencies such as argon2 and libzip.

3. Install PHP 8.0 and extensions

All PHP 8.0 packages follow php8.0-NAME pattern, and php8.0-common package includes a sensible set default of extensions (such as `php8.0-).

Install PHP 8.0 with CLI

sudo apt install php8.0-common php8.0-cli -y

This command will install several PHP extensions due to php8.0-common, and the CLI for PHP 8.0.

You can confirm the installation by running:

php -v # Show PHP version.
php -m # Show PHP modules loaded.

Additional extensions

You can install additional extensions from the same php8.0-NAME pattern. Refer to the packages.txt file to see a list of existing packages if you are upgrading an existing system.

Note that you do not need to install php8.0-json as it is now included by default.

An example to install a few more useful extensions:

sudo apt install php8.0-{bz2,curl,intl,mysql,readline,xml}

For development environments, code coverage tools or the Xdebug debugger can be installed as well.

sudo apt install php8.0-pcov # PCOV code coverage tool
sudo apt install php8.0-xdebug # Xdebug debugger

Install Server APIs

Depending on the web server you use, you will need to install additional packages to integrate with the web server.

For Apache using mpm_event, Nginx, Litespeed, etc., php8.0-fpm package provides integration with PHP 8.0 via FPM.

sudo apt install php8.0-fpm

For Apache using mod_php, install libapache2-mod-php8.0.

sudo apt install libapache2-mod-php8.0

Note that the Apache2Handler is renamed to php_module from php7_module in PHP 8.0. The libapache2-mod-php8.0 package automatically configures the Apache module location, but if you are updating from an existing PHP setup, you might need to update configuration files; in particularly blocks.

4. Test PHP 8.0 installation

To test the PHP installation and the extensions, run the following commands:

php -v
php -m
# php -v
PHP 8.0.0-dev (cli) (built: Oct 4 2020 14:04:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies

# php -m
[PHP Modules]
Core
ctype
curl
...

Purge old PHP versions

If the new installation is working as expected, you can remove the old PHP packages from the system.

sudo apt purge '^php7.4.*'

This assumes you are using PHP 7.4 as the previous version. Change php7.4 part of the command above with the appropriate PHP version.

Running PHP 8.0 with Other Versions

Instead of removing old PHP versions, it is also possible to run multiple PHP versions side-by-side.

The PHP 8.0 CLI will be installed at /usr/bin/php8.0 location by default. Similarly, other PHP binary files will be located in the same directory (/usr/bin/php7.4, /usr/bin/php7.3, etc). The default php name will be symlinked to the latest PHP version by default, but it is possible to change where the default php command links to.

The update-alternatives command provides an easy way to switch between PHP versions for PHP CLI.

sudo update-alternatives --config php

This brings up a prompt to interactively select the alternative PHP binary path that php points to.

There are 2 choices for the alternative php (providing /usr/bin/php).
Selection Path Priority Status

------------------------------------------------------------

* 0 /usr/bin/php8.0 80 auto mode
1 /usr/bin/php7.4 74 manual mode
2 /usr/bin/php8.0 80 manual mode

Press to keep the current choice[*], or type selection number:

To set the path without the interactive prompt:

update-alternatives --set php /usr/bin/php7.4

What's new and changed in PHP 8.0

For a complete list of changes in PHP 8.0, see What's new and changed in PHP 8.0


PHP 8 logo is by Vicent PONTIER. Debian and Ubuntu icons are from Strongicon and ProGlyphes.

How do I enable GD modules?

Installing PHP GD in Windows.
Step 1: Install XAMPP in your windows system..
Step 2: Verify if GD is already installed or not. ... .
Step 3: Locate and open php. ... .
Step 4: Find ;extension=gd..
Step 5: Remove semicolon from ;extension=gd and save the file..
Step 6: Go to php folder. ... .
Step 7: Look for php_gd. ... .
Step 8: Copy php_gd..

How install php8 0 in Linux?

How to install PHP 8 on Ubuntu 22.04.
Step 1: Update system repositories. ... .
Step 2: Install required dependencies. ... .
Step 3: Set up PHP repository. ... .
Step 4: Install PHP 8 on Ubuntu 22.04. ... .
Step 5: Verify PHP version. ... .
Step 6: Install PHP 8 Extensions. ... .
Step 7: Check PHP 8 loaded modules. ... .
Step 8: Check php-fpm status..

How do I fix GD library extension not available with this PHP installation?

Ten Thousand Strong.
Check your php.ini , so extension=php_gd2.dll is uncommented..
Try restarting your web server (Apache, Nginx).

What is PHP's GD extension?

Before you can start generating images with PHP, you need to check that you actually have image-generation capabilities in your PHP installation. In this chapter we'll discuss using the GD extension, which allows PHP to use the open source GD graphics library available from http://www.boutell.com/gd/.