Home » Php » php – Install Composer fails with "The openssl extension is missing" error

php – Install Composer fails with "The openssl extension is missing" error

Posted by: admin July 12, 2020 Leave a comment

Questions:

I’m attempting to install Composer but I get the following error:

“Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with –with-openssl”

I have then gone into my php.ini-production and uncommented:
“extension=php_openssl.dll”

This still doesn’t work though, is there something else I have to do?

How to&Answers:

I suspect “php.ini-production” is a dummy configuration file suitable for live environments. Do a php -i at the console and find the ‘php.ini’ path, to see where it is expecting the ini file to be kept. This is normally expecting “php.ini”, and may not actually exist – if it does not, copy php.ini-development (or similar) to the location required.

This is near the top of (a very long) output, so you may find redirecting it to a file helpful (php -i > C:\phpinfo.txt).

Answer:

You will also need to uncomment the extension dir. For example, find this line in your php.ini file:

;extension_dir = “ext”

Remove the semi-colon in front and save the file. I am sure this will work.

Remember to open your php.ini Administrator mode

Answer:

Make a php.ini (e.g. from php.ini-production), open it in an editor as admin (!), remove the commenting semicolon ; in front of extension=php_openssl.dll, set the extension_dir correctly, and save the file. After that it should be working. But once again: open and edit the php.ini as admin.

Answer:

If you are using MAMP on Windows, you need to change the extension for php.ini-development to php.ini Then, paste this line ;extension_dir = "ext" into the php.ini file, before the first extension appear, and uncomment this other line ;extension=php_openssl.dll removing the prefixed semicolon.
Dont’t forget to restart apache

Answer:

After changing anything in php.ini you have to restart your server, make sure you did so first of all.

Answer:

in WAMPserver edit this files:

D:\wamp\bin\php\php5.3.10\php.ini

or

D:\wamp\bin\php\php5.4.12\php.ini
(based on version)

Do not use the php.ini in the WAMP server menu. It will not work. Go to the root of your wamp and as indicated above with D as root.