Search code examples
phpdllxamppcomposer-php

Composer Installation "PHP Warning: PHP Startup: Unable to load dynamic library 'gd2'"


I am trying to install composer on my system but I am receiving an error "PHP Warning: PHP Startup: Unable to load dynamic library 'gd2'". I downloaded and placed the required gd_2.dll file in the folder. Checked php.ini for extension_dir and it has the absolute path E:\xampp\php\ext. Everything seems fine but I am still receiving this error. Please have a look at the screenshot below. In the image you can also see that I have the required .dll file highlighted which means I have the file that the installer reported as missing.

enter image description here

What should I do now?


Solution

  • I guess you have just installed PHP 8. Open your php.ini and locate the line near the bottom of the file:

    [PHP_GD2]
    extension=php_gd2.dll
    

    Change the extension name from php_gd2.dll to php_gd.dll (this should match the one existing in your ext directory) and save the php.ini. Run the Composer installation again.

    (PHP 8 somehow renamed php_gd2 to php_gd.)