9

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?

automatix
  • 14,018
  • 26
  • 105
  • 230
keynesiancross
  • 3,441
  • 15
  • 47
  • 87
  • Possible duplicate of [Composer Warning: openssl extension is missing. How to enable in WAMP](http://stackoverflow.com/questions/14062055/composer-warning-openssl-extension-is-missing-how-to-enable-in-wamp) – François Breton Mar 31 '17 at 15:40

6 Answers6

4

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

3

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

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    Thanks mate. Can you please explain this part: Do a php -i at the console and find the 'php.ini' path I"m totally new at this... – keynesiancross Aug 01 '14 at 01:00
  • You're on Windows, right? Open a `cmd` window, and type that command. Give that a go, and if it doesn't work, the commonest issue on Windows is setting up the `PATH`. If you get an error that `php` is not found, search for "Windows PHP path". – halfer Aug 01 '14 at 10:51
  • I just copied the php.ini-production into a new file called php.ini and it fixed the problem. Why doesn't PHP 7 just come with a file called php.ini rather than 2 files called php.ini-development and php.ini-production? – matthewpark319 Jun 29 '17 at 20:17
  • @MatthewPark: that could be a decision made by your Linux distro maintainers. What OS are you using? – halfer Jun 30 '17 at 07:15
  • @halfer I'm on Windows 10 – matthewpark319 Jun 30 '17 at 18:58
3

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.

automatix
  • 14,018
  • 26
  • 105
  • 230
3

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

olasammy
  • 6,676
  • 4
  • 26
  • 32
1

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

  • I'm just trying to install it locally... does that just mean restart my computer? ie, i downloaded the zip and unzipped it... thats the extent of what I've done.. – keynesiancross Aug 01 '14 at 00:32
  • @keynesiancross When you install a new extension for php, the php process needs to be restarted so that it can actually have access to that extension. You have probably installed it and edited your configuration files but you still need to restart the php process so that it reloads the configuration file(.ini) with the new extension. This is done differently depending on what web server you are using. `sudo service apache2 restart` if you're using apache2(httpd instead of apache2 if you're using apache1) with mod_php or sudo service php-fpm restart if you're using php-fpm. – echochamber Aug 01 '14 at 01:13
1

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.

MarkWhite
  • 11
  • 2