问题
I already uncommented in php.ini:
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
;extension=php_oci8_11g.dll
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
Variables of the system set ok.
PHP version 5.4.16:
C:\wamp\bin\php\php5.4.16\php.exe
Add to System path variable:
C:\ProgramData\ComposerSetup\bin
But, recive this 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'm using:
- windows 7
- Wamp
- php 5.1.16
- apache 2.4.4
How solve this problem, please help me.
回答1:
Open php.ini located in your "php" folder for example in xampp the file is in XYZ:\xampp\php\
Find
"extension=php_openssl.dll"
";extension=php_openssl.dll"
- remove";"
Restart your xampp (or whatever u use), extension should be loaded after that.
Try agien to install composer.
回答2:
ensure you are editing the php.ini locate on same place where is located php.exe, i was the same problem and wamp say the openssl is actived but Composer-Setup.exe used the php.ini in php directory/ext/ and wamp used C:\System...\php.ini,
Regards,
回答3:
I have battled this several times. And this is the best solution I have found.
As mentioned, you need to ensure that extension=php_openssl.dll
is enabled but doing just that sometimes may not resolve the error.
You should check that you have PHP on your path variable then see what INI file is loaded by typing php --ini
in the console it should give you something like:
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File: C:\WINDOWS\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Make sure you are enabling the settings in the correct ini file. If you dont have an ini file loaded put an ini file from the php directory into c:\windows
.
Also important
I find it helps to change the extension_dir
flag to an absolute path from relative to makesure the system can find php_opensll.dll
.
To do this uncomment the line starting extension_dir
and change it to match from the drive root.
Example: C:\php\ext
instead of ext/
回答4:
For MAMP users, this is what worked for me.
If your php.ini is located under a \MAMP\conf\
- copy the php.ini into a\MAMP\bin\php\php[your PHP version number]\
- Restart MAMP and the command-line window
- Go to a directory under a command-line window where you want to install composer
- run from a command line: php -r "readfile('http://getcomposer.org/installer');" | php
NOTE: it is http not https !
END
回答5:
The problem solved after turn off windows firewall.
installation complete!
回答6:
I figured it out and successfully installed Composer in My windows 10 PC.
I am sharing two solutions here.
There are some steps you have to follow in order to solve your problem.
1st solution.
- Find and Open
php.ini
located in your "php" folder In my case it is in xampp the file is inc:\xampp\php\
- Find
"extension=php_openssl.dll"
";extension=php_openssl.dll"
uncomment by removing the semicolon";"
- Restart your xampp , now extension should be loaded after that.
- Try again now you are able to install composer.
2nd solution(If the above solution not work for you then go with below solution . )
This works in my case
- Find and Open
php.ini
located in your "php" folder In my case it is in xampp the file is inc:\xampp\php\
- Open SHELL from Xampp start panel by clicking on shell button.
- Write
php
in shell and hit enter - If you get some waring message in your shell something like below .
Then you have to fix these waring message by commenting all these extension in your
php.ini
file.(Actually cause of these warning messages are because more than one time these extensions are enabled but you can un-comment it inphp.ini
file for solving the issue).For Example which is in my case.
a). You can see in above image there is warning message for curl.
Module 'curl' already loaded in Unknown on line 0 .
b) To fix this find
php_curl.dll
file in yourphp.ini
file and comment that extension by adding semicolon";"
in front of that extension like this;extension=php_curl.dll
Follow above steps if you have more than one warning for each extension untill you are not getting any warning message in your shell.
- Restart your xampp , now extension should be loaded after that.
- Try again now you are able to install composer.
Hope I can solve your issue .
That's all folks . Happy coding !!! (amitamie.com) :-) ;-)
回答7:
I nearly wrapped my head off trying to install composer on my windows 7 machine.
I was trying to install composer through the composer installer from getcomposer.org.
After the common openssl extension enabling (As above answers describing).
The installer has finished the installation successfully. But calling composer on the command line, wasnt possible. It was telling me composer / application not found, check for typos etc...
Cant getting it running, I looked at the manually install guide and noticed something weird.
The doc said: "Close your current terminal. Test usage with a new terminal:"
I closed my terminal window. Opened a new one and IT WORKED!!!
I had a terminal window open during the composer installation. After that I was trying to call composer via the command line in this terminal. This didnt work.
So why did it not work? The composer installer downloads the composer.phar file and sets a environment path to it. The terminal only gets the environment PATHS, when it gets started. So of course the path wasnt set for the terminal.
Solution:
If you have a terminal open before the installation just close it and open a new terminal window to get composer ready to use!!!
I hope I can save someone a couple hours of living time.
回答8:
You can follow this guide:
http://abuango.net/2014/08/16/how-to-install-composer-on-windows-with-xampp/
Hope it helps you.
回答9:
- Find a
php.ini
inC:\wamp\bin\php\php5.4.16\
(the configuration file of PHP). - Remove
;
in lines;extension=php_openssl.dll
and;extension_dir = "ext"
. PHP will know that you are using a php_openssl extension and extension_dir is the location of extensions (you can see it in the comment above php_openssl). - Run the Windows command prompt with administrator permissions.
- Execute the following command:
mklink C:\Windows\php.ini C:\wamp\bin\php\php5.4.16\php.ini
Composer search php.ini
in C:\Windows\php.ini
and you have your PHP in WAMP. With mklink
command you create a link php.ini
that aim to your WAMP's php.ini
.
回答10:
i was facing the same issue but i fixed that,
if you are using wamp
goto your selected php version directory and then you need to edit that directory php.ini file
replace this line ;extension=php_openssl.dll to extension=php_openssl.dll
and save and then restart then it will be working :)
回答11:
Beside all of the above If php/xampp is not installed in c drive this problem occurred (what happened with me).
In that case please follow this link : http://abuango.net/2014/08/16/how-to-install-composer-on-windows-with-xampp/
回答12:
I was facing the same issue in windows 7 PC with xampp.
Cannot open '\xampp\php\extras\browscap.ini' for reading in Unknown on line 0
I just change the value of 'browscap' in php.ini file. Use full path instead of absolute path.
In my case Xampp was in E drive so I have changed browscap="\xampp\php\extras\browscap.ini" to browscap="E:\xampp\php\extras\browscap.ini"
And it works for me!
来源:https://stackoverflow.com/questions/22763452/composer-not-install-in-windows-7