3

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?

2
  • Make sure you have both the correct bit-ness (32/64) as well as thread safety. I have seen misleading PHP messages because of this before on Windows Commented May 10, 2021 at 22:19
  • Please share more details. It looks suspicious to me that all dll files have the same timestamp, but that single one is eighteen months older Commented May 11, 2021 at 16:17

2 Answers 2

13

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.)

Sign up to request clarification or add additional context in comments.

Comments

0

In my php.ini i changed extension=gd2 to extension=gd and it worked

2 Comments

Please don't duplicate existing answers. Rather upvote that answer that helped you resolve your problem
i just wrote it because i didn't have extension=php_gd2.dll in my php.ini but extension=gd2 and it took me some time to figure out, i did upvote the previous answer, i just want to help i don't care about ratings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.