phpubuntugdgd2

Enable GD support on PHP 7.2 in a Ubuntu 18.04


I need to enable GD support on PHP 7.2 in a Ubuntu 18.04 installation and I've found this solution on the web:

sudo apt-get install php7.2-gd

Since I'm not an expert and I'm worried about the already running configuration files, I have to ask if this command

or


Solution

  • This command will install the GD extension only if PHP 7.2 is already installed.

    If not, it will also install php7.2-common since it is a dependency.

    On a machine without PHP 7.2:

    sudo apt install php7.2-gd
    
    Reading package lists... Done
    [...]
    The following additional packages will be installed:
      php7.2-common
    The following NEW packages will be installed:
      php7.2-common php7.2-gd
    

    and with PHP 7.2 installed:

    sudo apt install php7.2-gd
    
    Reading package lists... Done
    [...]
    
    The following NEW packages will be installed:
      php7.2-gd
    

    Once installed, the GD config files will be created under /etc/php/7.2/(fpm|cli...)/conf.d and should be named xx-gd.ini.

    These config files are loaded after your main php.ini and contain extension specific settings (in your case, GD settings).