Enabling the GD library

The GD library is used to dynamically generate and display preview of images inside the file manager window. If the library isn't installed on your server, you will not see thumbnails.

Is GD library installed on the server?

The quickest way to check it is by using the command line:

php -r "phpinfo();" | grep "GD"

Alternatively, you can check whether PHP GD is installed and its version by creating a PHP script phpinfo.php that calls the phpinfo() function and checking for the gd extension in the output:

<?php
    phpinfo();
?>

You can run this file in the browser from your local server, typically, this will be http://localhost:8080/phpinfo.php.

Find the gd section:

GD enabled

If you do not see the value "enabled" next to the "GD Support" value or if there is no GD section in the output when running phpinfo(), it indicates that the GD library is not installed. In this case, you will need to install this library to enable its functionality.

How to install GD library

The installation process for php-gd varies depending on the operating system and server environment you are using. Here are the general steps to install php-gd extension on a Linux-based web server using the command line:

1. Open a terminal window and log in to your web server with root or superuser privileges.

2. Update the package repository to make sure you have the latest version of the packages:

sudo apt-get update

3. Install the php-gd package using the package manager.

For example, on Ubuntu or Debian-based systems, you can use the following command:

sudo apt-get install php-gd

This command will install the GD extension for the default or available PHP version in your system. If you have a different PHP version installed, make sure to adjust the package name accordingly.

Check your PHP version:

php --version

After that, you can run sudo apt-get install php<your-php-version>-gd, for example:

sudo apt-get install php8.2-gd
Note: Replace 8.x with the version of PHP you are using.

4. Restart web server.

After the installation is complete, restart the Apache or Nginx web server to reload the PHP extensions and configurations:

sudo service apache2 restart

or

sudo service nginx restart

5. Restart PHP-FPM service.

You will need to restart the PHP-FPM service as well in order for the changes to take effect. The exact command to restart PHP-FPM may vary depending on your server environment. Here is example of how to do it on Ubuntu/Debian with PHP version 8.x:

sudo service php8.2-fpm restart

Don't forget to adjust the package name accordingly your PHP version.

Preview generation still is not working

If php-gd is installed but generating preview does not work, there may be a few different reasons for this issue. Here are some steps you can take to troubleshoot the problem:

  • Check that the GD extension is enabled in your PHP configuration file. Look for the following line in your php.ini file and make sure it is not commented out (i.e., does not have a semicolon at the beginning of the line):

    extension=gd
  • The most popular problem is permissions (owner or mode) for the folder you specified as dirCache and dirFiles.

  • Check the PHP error log for any relevant error messages.

See also: