The openssl extension is missing, which means that secure https transfers are impossible.
Problem :
I am trying to install Composer but I am getting 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 also gone into my php.ini-production and uncommented the following code: «extension=php_openssl.dll» But still, it is not working for me, Am I missing something? Solution :
I had also faced the same issue in the past, please follow the below approach to resolve your issue: I doubt the «php.ini-production» is the dummy configuration file suitable for live environments. I will suggest you do a php -i at the console and also try to find the ‘php.ini’ path, to understand where it is expecting the ini file to be kept. It may be the case that normally it is expecting «php.ini», and it may not actually exist. If that is the case then, copy the php.ini-development (or equivalent) to the location required. This is very near the top of actually a very long output, so you may find it redirecting it to a file helpful (php -i > C:\phpinfo.txt). Another Solution :
I conceived «php.ini-production» is a dummy configuration file suitable for live environments. Do a php -i at the console and trace the ‘php.ini’ path, to view where it is expecting the ini file to be kept. This is generally expecting «php.ini», and may not really exist — in case it does not, copy php.ini-development (or same) to the location requisite. This is near the top of (a very long) output, hence you may trace redirecting it to a file useful php -i > C:\phpinfo.txt).
You will further require to uncomment the extension dir. For example, trace this line in your php.ini file: ;extension_dir = «ext»
Remove the semi-colon in front and save the file. I am certain this will perform. Remember to open your php.ini Administrator mode After altering anything in php.ini you have to restart your server, ensure that you did so first of all. 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 employ the php.ini in the WAMP server menu. It will not perform. Go to the origin of your wamp and as defined above with D as root. Create a php.ini (for example 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 accurately, and save the file. After that, it must be performed. However once again: open and edit the php.ini as admin. In case you are employing MAMP on Windows, you require to alter the extension for php.ini-development to php.ini . After that, paste this line ;extension_dir = «ext» into the php.ini file, prior to the first extension appearing and uncommenting this other line ;extension=php_openssl.dll removing the prefixed semicolon. Remember to restart apache A similar error happened to me. I solved it by turning off TLS for Composer, it’s not safe however I considered the risk on my development machine. Attempt this: composer config -g — disable-tls true
and re-run your Composer. It performs to me. However, it’s not secure and not recommended for your Server. The official website says: In the case set to true, all HTTPS URLs will be attempted with HTTP instead and no network-level encryption is worked. Enabling this is a security risk and is NOT recommended. The better method is to enable the php_openssl extension in php.ini. In case you don’t want to enable unsecure layer in your machine/server, so setup your php to enable OpenSSL and it also performed. Ensure that the PHP Openssl extension has been installed and enable it on php.ini file. To enable OpenSSL, add or trace 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 in case reqired For the composer reference, there are two relevant options: disable-tls and secure-http. nano ~/.composer/config.json .
«config»: «disable-tls»: true,
«secure-http»: false
>
>
Thereafter it complains much: You are running Composer with SSL/TLS protection disabled.
Warning: Accessing getcomposer.org over http which is an insecure protocol.
However, it works the composer selfupdate (or whatever). while one cannot easily «enable SSL in the php.ini» on Linux; PHP requires to be compiled with openSSL configured as shared library — in order to be able to access it from the PHP CLI SAPI. Hence, after inventioning and looking for a while I found that my PHP.INI obviously didn’t look in the accurate directory for my PHP Extensions, so I went under: «Directory in which the loadable extensions (modules) reside.» And casting the following: ; http://php.net/extension-dir
; extension_dir = «./»
; On windows:
;extension_dir = «ext»
And easily removed the ; infront of «extension_dir = «ext», note this is just for Windows, remove the semicolon in front of the first extension_dir in case you are running a different operating system.
Top comments (0)
Read next
Windows 基礎 Part 01 — キーボード変更
Dominando Laravel 2023
How to enable PHP’s openssl extension to install Composer ?
To perform the secure HTTPS transfers you will need to enable the openssl extension then you have to install the composer. In this article, we will cover the enabling openssl for XAMPP as well as WAMP one by one then we will install the composer.
- Enable openssl extension on XAMPP
- Enable openssl extension on WAMP
- Installation of Composer
Enable PHP’s openssl extension on XAMPP:
- Step 1: Open XAMPP control panel and click on the Config button for the Apache module.
- Step 2: Then from the given options, select PHP (php.ini) option. This will open the php.ini file in the default text editor (example: notepad).
- Step 3: Now we have to search for extension=openssl line in that file.
- Step 4: After you find it, see if there is any semicolon ‘;’ at the beginning of the line. If there is then that means it is disabled. So remove the semicolon to enable the extension.
- Step 5: Save and Close the file. And there you have openssl extension enabled.
Enable PHP’s openssl extension on WAMP:
- Step 1: Run the WAMP Server installed on the system.
- Step 2: Now Left Click on the Green WAMP icon on the bottom right corner in windows and go in PHP option.
- Step 3: Then go to the PHP extensions option and there you will find the openssl option. If there is a green tick mark at the beginning of it then it means it is enabled. If not then you can enable it by clicking it.
- Step 4: Now restart all the services and you have enabled openssl extension.
Note: You can also enable openssl on WAMP by going in the php.ini file.
Install Composer: After following the above steps for enabling the openssl, you can follow the following steps to install Composer
- Step 1: Download the Composer-Setup.exe file and run it.
- Step 2: After running, you will see a popup box asking for the install mode. Here select Install for all users, which is also a recommended option, and hit Yes.
- Step 3: In Installation Options window, we don’t want the Developer mode, so we will let it be unpicked and click on Next.
- Step 4: Now, you will have to choose the PHP command-line. For XAMPP, the path will be C:\xampp\php\php.exe and for WAMP, the path will be C:\wamp64\bin\php\php7.3.12\php.exe and click Next. If you don’t find the path in the drop down then you will have to browse it. The version of PHP can be different for you.
If don’t have installed Visual C++ Redistributable for Visual Studio then it will show you below error. So to proceed you have to install that first. - Step 5: Now in the Proxy Setting, leave every thing as it is and click on Next.
- Step 6: Now, verify the settings and click on Install.
- Step 7: Now you will see the following windows which means that the Composer is installed. Click on Next and hit Finish.
- Step 8: Now, to check if composer installed properly, open cmd, and type composer and hit Enter. If you see the output as below then it is successfully installed. If not then you will have to restart your PC and try again.
PHP OpenSSL extension has a package?
I know that OpenSSL extension is in PHP source, but I can’t enable it when I perform apt-get install php5 . There is not even a apt-get install php5-openssl . How I must proceed?
I know this post is old, just some general info. By default, PHP’s packages are distributed with —with-openssl=[defaultpath] . It means you only have to install openssl (or any other variant) e.g. sudo apt-get install openssl (also check which version of openssl to install due to heartbleed, e.g. sudo apt-cache policy openssl . To check wether PHP is enabled with openssl just type php -m | grep openssl and php -i | grep OpenSSL .
3 Answers 3
I think SSL support doesn’t depend on an extension, it’s already built into Ubuntu’s PHP. Try creating a PHP file in your web server with this content:
then access it in a browser ( http:///.php ). You should see:
I have only these PHP packages installed: libapache2-mod-php5, php5-cli, php5-common, php5-gd, php5-mcrypt, php5-mysql.
If you have the OpenSSL extension installed, you should see something like this:
openssl OpenSSL support => enabled OpenSSL Library Version => OpenSSL 1.0.1f 6 Jan 2014 OpenSSL Header Version => OpenSSL 1.0.1f 6 Jan 2014 openssl.cafile => no value => no value openssl.capath => no value => no value OpenSSL support => enabled
It seems that the OpenSSL extension is installed by default.
If you don’t have this extension, you can edit php.ini file.
;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; If you wish to have an extension loaded automatically, use the following ; syntax: ; ; extension=modulename.extension ; ; For example, on Windows: ; ; extension=msql.dll ; ; . or under UNIX: ; ; extension=msql.so ; ; . or with a path: ; ; extension=/path/to/extension/msql.so ; ; If you only provide the name of the extension, PHP will look for it in its ; default extension directory. ;