Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable PHP's openssl extension to install Composer?

It is possible that WAMP and Composer are using different PHP installations. Composer will use the PHP set in the PATH environment variable.

If you want to enable the openssl extension to install Composer, first you need to check the location of the PHP installation.

  1. Open a Command Prompt, type: echo %PATH% then check for the location of your PHP installation.
  2. Go to that location and edit the file named: php.ini.
  3. Uncomment the line extension=php_openssl.dll by removing the semicolon at the beginning.

Now you are good to install Composer.


I solved my problem a different way. The problem is that wamp's GUI was misleading: it claimed that I had php_openssl enabled.. and if I clicked on php.ini on the same GUI.. it actually showed that extension=php_openssl.dll was uncommented..

I'm not sure if i'm using the same installer version of composer of the OP, but it actually asks you at the beginning to specify the php.exe that you like to apply composer on (which basically ensures that no one tries to apply composer to the wrong php executable as what happened with the OP)..

The way I solved this was by going myself into the installation of php within the wamp package: C:\wamp\bin\php\php5.4.12 and looking php.in there.. when I opened it I was shocked that the line extension=php_openssl.dll was actually commented! I uncommented it and it worked just fine.

enter image description here


I had the same problem and here the solution I found, on your php.ini you need to do some changes:

  1. extension_dir = "ext"
  2. extension = php_openssl.dll

Every one here talks active the openssl extension, but in windows you need to active the extension dir too.


For WAMP server, comment given by "Enrique" solved my problem.

wamp is using this php.ini:

c:\wamp\bin\apache\Apache2.4.4\bin\php.ini

But composer is using PHP from CLI, and hence it's reading this file:

c:\wamp\bin\php\php5.4.12\php.ini (so you need to enable openssl there)

For composer you will have to enable extension in

c:\wamp\bin\php\php5.4.12\php.ini

Change:

;extension=php_openssl.dll 

to

extension=php_openssl.dll

If you're doing this on Windows without one of the WAMP stacks, here's how to get this going

  1. Download an installation of PHP for Windows. Generally you'll want a non-thread safe install. You can use 32-bit or 64-bit builds
  2. Extract the zip file somewhere. I would suggest C:\php. Composer's installer found it there without any additional prompting
  3. The latest versions of PHP for Windows do not come with a php.ini by default. Instead, you'll see two files, as noted below. Rename one to php.ini or copy it into php.ini.
    • php.ini-development
    • php.ini-production
  4. Open your php.ini file and remove the semicolon from this line (you might want to uncomment other things as well but this line is the only one necessary for Composer)

    ;extension=php_openssl.dll
    

That should be all you need to do. The Composer installer should do everything else you need from here.


You need to enable "extension=php_openssl.dll" in both files (php and apache). my pc files path are these :

  1. C:\wamp\bin\php\php5.3.13\php.ini
  2. C:\wamp\bin\apache\apache2.2.22\bin\php.ini