install composer fails in windows 10 The openssl extension is missing - php

openssl missing whene install composer
my windows: 10
local server: UwAmp
I've activated openssl in :
C:\UwAmp\bin\apache\php.ini
C:\UwAmp\bin\php\php-5.4.31\php.ini-development & php.ini-production (2 files) by delete - ; -
As well as from UwAmp GUI
But
This problem is not solved
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
Thank you

I ran into the same issue installing Composer with MAMP for Windows 10. My php.ini file was not in the same directory as php.exe. I'm guessing Composer doesn't know to look elsewhere for the ini.
Try making a copy of your php.ini from C:\UwAmp\bin\apache\php.ini, pasting it into C:\UwAmp\bin\php\php-5.4.31, and then try to run the Composer setup again. Confirm that extension=php_openssl.dll is not commented out with a ;.

Copy php.in from php dir to Apache24/bin works for me. Please make sure you enable the extension in there.

Composer has nothing to do with apache, so C:\UwAmp\bin\apache\php.ini doesn't matter.
php.ini-development and php.ini-production are sort of examples to get started with. So you should choose one (probably development) and rename it to php.ini for it to actually work.

Related

Composer and Curl issue [duplicate]

composer create-project flarum/flarum . --stability=beta
I try to run this command, but it gave me this error.
[RuntimeException]
The openssl extension is required for SSL/TLS protection but is not availab
le. If you can not enable the openssl extension, you can disable this error
, at your own risk, by setting the 'disable-tls' option to true.
I tried to add "extension=php_openssl.dll" to "php.ini", but it still got this error
The same error occurred to me. I fixed it by turning off TLS for Composer, it's not safe but I assumed the risk on my develop machine.
try this:
composer config -g -- disable-tls true
and re-run your Composer. It works to me!
But it's unsecure and not recommended for your Server. The official website says:
If set to true all HTTPS URLs will be tried with HTTP instead and no network-level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini.
If you don't want to enable unsecure layer in your machine/server, then setup your php to enable openssl and it also works. Make sure the PHP Openssl extension has been installed and enable it on php.ini file.
To enable OpenSSL, add or find and uncomment this line on your php.ini file:
Linux/OSx:
extension=php_openssl.so
Windows:
extension=php_openssl.dll
And reload your php-fpm / web-server if needed!
UPDATE:
As of PHP 7.4 the extension is named extension=openssl (known for Windows).
This issue occurs due to openssl and extension directory so uncomment below extensions in php.ini file
extension=php_openssl.dll
extension_dir = "ext"
Its works on my machine.
I had the exact same problem and couldn't find a solution, so after thinking and looking for a while I figured that my PHP.INI apparently didn't look in the correct directory for my PHP Extensions, so I went under:
"Directory in which the loadable extensions (modules) reside."
And found the following:
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
;extension_dir = "ext"
And simply removed the ; infront of "extension_dir = "ext", note this is only for Windows, remove the semicolon in front of the first extension_dir if you are running a different operating system.
I have no idea why mine wasn't already unmarked, but it's just something to look for if you are having problems.
According to the composer reference there are two relevant options: disable-tls and secure-http, which one can use. Just edit the configuration with: nano ~/.composer/config.json:
{
"config": {
"disable-tls": true,
"secure-http": false
}
}
Then it will complain about:
You are running Composer with SSL/TLS protection disabled.
Warning: Accessing getcomposer.org over http which is an insecure protocol.
But it performs the composer selfupdate (or whatever command).
One cannot simply "enable SSL in the php.ini" on Linux; PHP needs to be compiled with openSSL configured as shared library - in order to be able to access it from the PHP CLI SAPI.
To enable openssl go into php.ini and enable this line:
extension=php_openssl.dll
if you don't want enable openssl you can set to composer not use openssl with this command:
composer config -g -- disable-tls true
however, this is a security problem.
After trying everything, I finally managed to get this sorted. None of the above suggested solutions worked for me. My system is A PC Windows 10. In order to get this sorted I had to change the config.json file located here C:\Users\[Your User]\AppData\Roaming\Composer\. In there, you will find:
{
"config": {
"disable-tls": true},
"repositories": {
"packagist": {
"type": "composer",
"url": "http://repo.packagist.org" // this needs to change to 'https'
}
}
}
where you need to update the packagist repo url to point to the 'https' url version.
I am aware that the above selected solution will work for 95% of the cases, but as I said, that did not work for me. Hope this helps someone.
Happy coding!
I had the same problem. I tried everything listed on this page. When I re-installed Composer it worked like before. I had a PHP version mismatch that was corrected with a new install establishing the dependencies with the PHP path installed in my system environment variables.
I DO NOT RECOMMEND the composer config -g -- disable-tls true approach.
By the way the way to reverse this is composer config -g -- disable-tls false.
I just add this because it worked for me, i install composer with the developer option activate (just check the box in the installer)
https://getcomposer.org/Composer-Setup.exe
I think this problem may occurs when you add a new version of php to your wamp server.
If you do this, you have to check if the extension_dir variable is configure to "env".
Then check if the php_openssl.dll exist in your phpx.x/ext folder. If there is not php_openssl.dll, you have to download it here :
http://www.telecharger-dll.fr/dll-php_openssl.dll.html
If it still not working, check if your apache server use the good php.ini file by running the following cmd command :
php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\wamp64\bin\php\php7.4.7x64\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
If the loaded configuration file return (none), you have to check your appache/apache2.4.41/conf/httpd.conf file is configure with the proper phpIniDir and the correct module.
It must be something like this :
PHPIniDir "${APACHE_DIR}/bin"
LoadModule php7_module "${INSTALL_DIR}/bin/php/php7.4.7x64/php7apache2_4.dll"
Then restart apache and check the "apache/apache2.4.41/bin/php.ini" (wich is the one configure above by PHPIniDir) it must me like
You are running Composer with SSL/TLS protection disabled.
composer config --global disable-tls true
composer config --global disable-tls false
For me on Windows 10 none of those worked ... I had changed my local server from WAMP to Laragon and had to add the new path to the php.ini in the Environment Variables under:
Control Panel --> Advanced System Settings --> Environment Variables --> Path (double click) --> Browse... then navigate to the php.ini and click ok.
After that a reboot was needed and now composer works like a charm!
I had this issue on IIS on my new home server when attempting to install Magento. To fix it i added the above: extension=php_openssl.dll in my php.ini and then restarted my IIS server on Windows 10 Pro.
I was just having this issue, but these solutions weren't working since I installed PHP and Apache independently without Xampp or Wamp.
The problem for me turned out to be that I was trying to run composer from Git for Windows instead of cmd or PowerShell—where it turned out to be working fine.
My solution was to add a symlink from my /c/php/php.ini (C:\php\php.ini) to my /bin/ directory (C:\Program Files\Git\bin).
lot of answers already, but this is what worked for me (in case someone still needs it)
Just upgraded from php 7.3.x to 7.4.33 in Windows 10, and this error occurred to me, so Just went back to the composer.exe installer, re-run the installation process once again pointing to the new php 7.4. folder, and it worked.

Windows 10, mamp, composer not installing, but openssl & extension_dir enabled

I have mamp installed and am using windows 10. I have attached an image of the configurations, the error, and some of the things I've done to diagnose why. I don't know why I am continuously getting this composer error. I am updating my php.ini file, which had openssl commented out. I removed the semicolon on extension_dir (was already removed), and on extension=php_openssl.dll. I have noticed that when I type in php -m in my command prompt, I am not seeing open ssl, and I'm not sure how to enable that, if that is the possible issue.
If there can be any light shed on this, let me know, I understand this issue is answered hundreds of times over, but I have done what was required from those answers, and got no where.
Image clarifications: The error
Here is where I am checking the configurations with php -m and it's not showing openssl, correct me if I'm mistaken.
My phpinfo(); with also me doing php -ini, it's showing php isn't set, but it is when I run the phpinfo method, i'm assuming because this method is being run through mamp allowing it to set the correct parameters.
You have to make sure that the command-line PHP loads an ini file somehow. The easiest is probably to copy c:\MAMP\conf\php7.0.0\php.ini to wherever your php.exe is located. To find that out you can use where php which should return you the full path to it. Copy the ini file in that directory and it should find it and load the module (although you might have to adjust the extension_dir depending on how it is set).
See http://php.net/manual/en/configuration.file.php if you want more details on how the ini file is located.
you only need to copy php.ini from the conf directory to your php directory and it will work fine.
just copy php.ini from
MAMP/conf/php(version of your php)/php.ini
to
MAMP/bin/php/php(version of your php)
then try in command line `php composer.phar install'
for install composer and enable openssl extension, copy your php.conf in MAMP\conf\php{php-version} for MAMP\bin\php\php{php-version} and edit php.conf changing ;extension=php_openssl.dll for extension=php_openssl.dll.
Then try installing normally.
Running Windows 10 with MAMP PRO. Copy the version php.ini file to the folder that has the php.exe. In my case, I copied MAMP/conf/php7.2.1/php.ini file to MAMP/bin/php7.2.1/ folder.
Restarted MAMP PRO 4.
Ran the command line, replacing some-dir with my new Drupal 8 project.
composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
Worked beautifully!

The openssl extension is required for SSL/TLS protection

composer create-project flarum/flarum . --stability=beta
I try to run this command, but it gave me this error.
[RuntimeException]
The openssl extension is required for SSL/TLS protection but is not availab
le. If you can not enable the openssl extension, you can disable this error
, at your own risk, by setting the 'disable-tls' option to true.
I tried to add "extension=php_openssl.dll" to "php.ini", but it still got this error
The same error occurred to me. I fixed it by turning off TLS for Composer, it's not safe but I assumed the risk on my develop machine.
try this:
composer config -g -- disable-tls true
and re-run your Composer. It works to me!
But it's unsecure and not recommended for your Server. The official website says:
If set to true all HTTPS URLs will be tried with HTTP instead and no network-level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini.
If you don't want to enable unsecure layer in your machine/server, then setup your php to enable openssl and it also works. Make sure the PHP Openssl extension has been installed and enable it on php.ini file.
To enable OpenSSL, add or find and uncomment this line on your php.ini file:
Linux/OSx:
extension=php_openssl.so
Windows:
extension=php_openssl.dll
And reload your php-fpm / web-server if needed!
UPDATE:
As of PHP 7.4 the extension is named extension=openssl (known for Windows).
This issue occurs due to openssl and extension directory so uncomment below extensions in php.ini file
extension=php_openssl.dll
extension_dir = "ext"
Its works on my machine.
I had the exact same problem and couldn't find a solution, so after thinking and looking for a while I figured that my PHP.INI apparently didn't look in the correct directory for my PHP Extensions, so I went under:
"Directory in which the loadable extensions (modules) reside."
And found the following:
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
;extension_dir = "ext"
And simply removed the ; infront of "extension_dir = "ext", note this is only for Windows, remove the semicolon in front of the first extension_dir if you are running a different operating system.
I have no idea why mine wasn't already unmarked, but it's just something to look for if you are having problems.
According to the composer reference there are two relevant options: disable-tls and secure-http, which one can use. Just edit the configuration with: nano ~/.composer/config.json:
{
"config": {
"disable-tls": true,
"secure-http": false
}
}
Then it will complain about:
You are running Composer with SSL/TLS protection disabled.
Warning: Accessing getcomposer.org over http which is an insecure protocol.
But it performs the composer selfupdate (or whatever command).
One cannot simply "enable SSL in the php.ini" on Linux; PHP needs to be compiled with openSSL configured as shared library - in order to be able to access it from the PHP CLI SAPI.
To enable openssl go into php.ini and enable this line:
extension=php_openssl.dll
if you don't want enable openssl you can set to composer not use openssl with this command:
composer config -g -- disable-tls true
however, this is a security problem.
After trying everything, I finally managed to get this sorted. None of the above suggested solutions worked for me. My system is A PC Windows 10. In order to get this sorted I had to change the config.json file located here C:\Users\[Your User]\AppData\Roaming\Composer\. In there, you will find:
{
"config": {
"disable-tls": true},
"repositories": {
"packagist": {
"type": "composer",
"url": "http://repo.packagist.org" // this needs to change to 'https'
}
}
}
where you need to update the packagist repo url to point to the 'https' url version.
I am aware that the above selected solution will work for 95% of the cases, but as I said, that did not work for me. Hope this helps someone.
Happy coding!
I had the same problem. I tried everything listed on this page. When I re-installed Composer it worked like before. I had a PHP version mismatch that was corrected with a new install establishing the dependencies with the PHP path installed in my system environment variables.
I DO NOT RECOMMEND the composer config -g -- disable-tls true approach.
By the way the way to reverse this is composer config -g -- disable-tls false.
I just add this because it worked for me, i install composer with the developer option activate (just check the box in the installer)
https://getcomposer.org/Composer-Setup.exe
I think this problem may occurs when you add a new version of php to your wamp server.
If you do this, you have to check if the extension_dir variable is configure to "env".
Then check if the php_openssl.dll exist in your phpx.x/ext folder. If there is not php_openssl.dll, you have to download it here :
http://www.telecharger-dll.fr/dll-php_openssl.dll.html
If it still not working, check if your apache server use the good php.ini file by running the following cmd command :
php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\wamp64\bin\php\php7.4.7x64\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
If the loaded configuration file return (none), you have to check your appache/apache2.4.41/conf/httpd.conf file is configure with the proper phpIniDir and the correct module.
It must be something like this :
PHPIniDir "${APACHE_DIR}/bin"
LoadModule php7_module "${INSTALL_DIR}/bin/php/php7.4.7x64/php7apache2_4.dll"
Then restart apache and check the "apache/apache2.4.41/bin/php.ini" (wich is the one configure above by PHPIniDir) it must me like
You are running Composer with SSL/TLS protection disabled.
composer config --global disable-tls true
composer config --global disable-tls false
For me on Windows 10 none of those worked ... I had changed my local server from WAMP to Laragon and had to add the new path to the php.ini in the Environment Variables under:
Control Panel --> Advanced System Settings --> Environment Variables --> Path (double click) --> Browse... then navigate to the php.ini and click ok.
After that a reboot was needed and now composer works like a charm!
I had this issue on IIS on my new home server when attempting to install Magento. To fix it i added the above: extension=php_openssl.dll in my php.ini and then restarted my IIS server on Windows 10 Pro.
I was just having this issue, but these solutions weren't working since I installed PHP and Apache independently without Xampp or Wamp.
The problem for me turned out to be that I was trying to run composer from Git for Windows instead of cmd or PowerShell—where it turned out to be working fine.
My solution was to add a symlink from my /c/php/php.ini (C:\php\php.ini) to my /bin/ directory (C:\Program Files\Git\bin).
lot of answers already, but this is what worked for me (in case someone still needs it)
Just upgraded from php 7.3.x to 7.4.33 in Windows 10, and this error occurred to me, so Just went back to the composer.exe installer, re-run the installation process once again pointing to the new php 7.4. folder, and it worked.

php 5.6.17 has no php.ini

I'm trying to install composer to get laravel working.
Composer gave me 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
According to this post I need to uncomment the openssl extension.
composer not install in windows 7
The problem is I don't have a php.ini file in my php directory. There is a php.ini-development and php.ini-production. Do I just rename one of them to php.ini?
This post is in regards to XAMPP, it says that the php.ini file needs to be edited and not the php.ini-development or php.ini.production.
Php.ini production vs development
I downloaded the non-thread safe php x86 from here
http://windows.php.net/download/
Cheers
just copy paste php-development.ini and rename it to php.ini.
php 7.0.3 is already out!
use php.ini-development for your development server. use php.ini-production for your production server. Copy and rename it to php.ini

Composer Warning: openssl extension is missing. How to enable in WAMP

Trying to install Composer dependency management tool on Win7/64 + WampServer 2.2 via the Setup Installer and I am getting the following message:
The openssl extension is missing, which will reduce the security and stability of Composer.
If possible you should enable it or recompile php with --with-openssl
So here is what I did...
From my Wamp icon in Tray, clicked php > php extensions > php_openssl
This showed that task was completed by placing a check mark beside the extension
I then restarted WampServer
Then from the Wamp icon in tray, I clicked php > php.ini and searched for openssl to verifiy it was NOT commented) out. It was not.
I then went back to Composer-Setup.exe and tried again. Same Warning Message: "openssl extension is missing"
Having never worked with OpenSSL, I'm not sure what is supposed to be set, so I tried to browse to one of my local sites using https. It Failed.
What am I missing?
Please advise.
WAMP uses different php.ini files in the CLI and for Apache. when you enable php_openssl through the WAMP UI, you enable it for Apache, not for the CLI.
You need to modify C:\wamp\bin\php\php-5.4.3\php.ini to enable it for the CLI.
In addition to uncommenting the ;extension=php_openssl.dll line in php.ini that everyone else has mentioned, you also have to ensure the ;extension_dir = "ext" line is also uncommented. To uncomment, remove the prefixed semicolon and save.
That line might already be uncommented in packages like WAMP and XAMPP, but it's not in a plain PHP download for Windows, so it's worth verifying. Also, you have to create the php.ini file by copying one of the examples, like php.ini-development to a new file and then name it php.ini. Then make these changes there.
Also, in the future, to install tools such as PHP and Composer, I recommend using the Chocolatey package manager. Then it's as simple as choco install composer. Of course, you'd still need to edit php.ini before installing Composer with the choco method. In future versions of Windows, package management tools like Chocolatey will be baked into Windows, the same way apt-get is in Ubuntu. Exciting times ahead for developers!
With either method, after installing Composer, don't forget to restart your terminal. Whether you're using Command Prompt, Bash (installs with Git), or Powershell, you'll need to restart it before the updated environmental variables work.
I had the same problem even though openssl was enabled. The issue was that the Composer installer was looking at this config file:
C:\wamp\bin\php\php5.4.3\php.ini
But the config file that's loaded is actually here:
C:\wamp\bin\apache\apache2.2.22\bin\php.ini
So I just had to uncomment it in the first php.ini file and that did the trick. This is how WAMP was installed on my machine by default. I didn't go changing anything, so this will probably happen to others as well. This is basically the same as Augie Gardner's answer above, but I just wanted to point out that you might have two php.ini files.
uncomment ;extension=php_openssl.dll in both
wamp\bin\php\php5.4.12\php.ini
wamp\bin\apache\Apache2.4.4\bin\php.ini
it will work
C:\laravel-master>composer create-project laravel/laravel
Installing laravel/laravel (v4.0.6)
- Installing laravel/laravel (v4.0.6)
[RuntimeException]
You must enable the openssl extension to download files via https
I'm using EasyPhp (WAMP type). In the EasyPHP Icon in the taskbar, right click and select configuration then select PHP. I will open the PHP.ini file configuration in a Notepad, search-find or CTRL+F in notepad for the word OPENSSL you will find this ;extension=php_openssl.dll just remove the ; and the extension=php_openssl.dll is active.
C:\laravel-master>composer create-project laravel/laravel
Installing laravel/laravel (v4.0.6)
- Installing laravel/laravel (v4.0.6)
Downloading: 100%
Created project in C:\laravel-master\laravel
Loading composer repositories with package information
Installing dependencies (including require-dev)
you need to edit the "c:\Program Files\wamp\bin\php\php5.3.13\php.ini" file
search for:
;extension=php_openssl.dll
remove the semicolon at the beginning
note: if saving the file doesn't work then you need to edit it as administrator. (on win7) go to start menu, search for notepad, right-click on notepad, click "Run As Administrator"
in the composer installation windows just click back then next (or close it and start again) and it should work
opened wamp/bin/apache/apache2.4.4/bin/php config..
wamp/bin/php/php5.4.16/php conf settings, php-ini production, php-ini dev, phpForApache find extension=php_openssl.dll and uncomment by removing ;
Short and sweet, uncomment this line in wamp/bin/php/php5.3.13(or whatever php version):
;extension=php_openssl.dll (remove the ;)
Now run the command line installation of Composer. You won't have an error.
Good to go!
You should make a symlink to php.ini. Sorry for russian link.
Yes, you must have to open php.ini and remove the semicolon to:
;extension=php_openssl.dll
remove the ";" like this and it will work.
extension=php_openssl.dll
Happy Coding.
For installing Composer below steps worked me:(WAMP version 2.4 x64bit)
edit ->
**C:\wamp\bin\php\php5.4.12\php.ini**
;;uncomment below line or remove the semicolons ';'
extension=php_openssl.dll
**C:\wamp\bin\apache\Apache2.4.4\bin\php.ini**
extension=php_openssl.dll
All those answers are good, but in fact, if you want to understand, the extension directory need to be right if you want all you uncommented extensions to work. Can write a physical or relative path like
extension_dir = "C:/myStack/php/ext"
or
extension_dir = "../../php/ext"
It's relative to the httpd.exe Apache web server (C:\myStack\apache\bin)
But if you want it to work with Composer or anything you need the physical path because the cli mode doesn't use the web server !
I was facing the same issue. I renamed my php folder from php7_winxxxx to just php and it worked fine. It looked like composer was checking the location to the php_openssl module in c:/php/ext.
You may also need to add c:/php to the PATH in environment variable

Categories