php Composer 设置安装错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41489614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Composer setup installation error
提问by rango
I'm trying to install Composer on Windows 7 and XAMPP, but getting those errors/messages when run installation setup.
我正在尝试在 Windows 7 和 XAMPP 上安装 Composer,但在运行安装设置时收到这些错误/消息。
The PHP exe file you specified did not run correctly: C:\xampp\php\php.exe
The php.ini used by your command-line PHP is: C:\xampp\php\php.ini
A duplicate setting in your php.ini could be causing the problem.
Program Output: Warning: Module 'openssl' already loaded in Unknown on line 0
您指定的 PHP exe 文件没有正确运行:C:\xampp\php\php.exe
你的命令行 PHP 使用的 php.ini 是:C:\xampp\php\php.ini
php.ini 中的重复设置可能会导致问题。
程序输出:警告:模块“openssl”已加载到第 0 行的未知中
I have been googled for while, but could not find proper solution or anything related to this. Closest thing was to remove comment openssl extension in php.ini file, but did not worked for me. To be clear I have very basic understanding of server tweaking.
我已经用谷歌搜索了一段时间,但找不到合适的解决方案或与此相关的任何内容。最近的事情是删除 php.ini 文件中的注释 openssl 扩展名,但对我不起作用。需要明确的是,我对服务器调整有非常基本的了解。
采纳答案by rango
OpenSSL is being loaded twice. Look in your php.ini above to see openssl.dll, and comment it out in one of the places.
– Farkie
OpenSSL 被加载两次。在上面的 php.ini 中查看 openssl.dll,并在其中一个地方将其注释掉。
– 法基
回答by Amit Kumar
I guess this is a problem which had been asked hereyou can follow the solution or go to the below link whichever if you want .
我想这是一个在这里被问到的问题,您可以按照解决方案进行操作,或者如果您愿意,可以访问以下链接。
composer not install in windows 7
I figured it out and successfully installed Composer in My windows 10 PC.
我想通了,并成功地在我的 Windows 10 PC 中安装了 Composer。
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.
- 查找并打开
php.ini
位于您的“php”文件夹中在我的情况下,它在 xampp 中,文件在c:\xampp\php\
- 找
"extension=php_openssl.dll"
";extension=php_openssl.dll"
通过删除分号取消注释";"
- 重新启动您的 xampp ,现在应该在此之后加载扩展。
- 现在再试一次,您就可以安装 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 times that extension are enabled or you can say un-commentedinphp.ini
file).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
- 查找并打开
php.ini
位于您的“php”文件夹中在我的情况下,它在 xampp 中,文件在c:\xampp\php\
- 通过单击 shell 按钮从 Xampp 开始面板打开 SHELL。
php
在 shell 中写入并按 Enter- 如果您在 shell 中收到一些警告消息,如下所示。
然后,您必须通过在
php.ini
文件中注释所有这些扩展名来修复这些警告消息。(这些警告消息的实际原因是因为该扩展名被启用了不止一次,或者您可以在文件中说未注释php.ini
)。例如,在我的情况下。
一种)。您可以在上图中看到 curl 的警告消息。
Module 'curl' already loaded in Unknown on line 0 .
b) 要
php_curl.dll
在您的php.ini
文件中修复此查找文件并通过";"
在该扩展名前面添加分号来注释该扩展名,如下所示;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.
如果每个扩展都有多个警告,请按照上述步骤操作,直到在 shell 中没有收到任何警告消息。
- Restart your xampp , now extension should be loaded after that.
- Try again now you are able to install composer.
- 重新启动您的 xampp ,现在应该在此之后加载扩展。
- 现在再试一次,您就可以安装 Composer 了。
Hope I can solve your issue .
希望我能解决你的问题。
That's all folks . Happy coding !!! (amitamie.com) :-) ;-)
这就是所有的人。快乐编码!!!(amitamie.com) :-) ;-)
回答by Sarim
- Go to your xampp\php\php.ini
- Press ctrl+f to find extension_dir and change its relative path to absolute path e.g from extension_dir="\ext" to extension_dir="E:\xampp\php\ext"
- Press ctrl+f to find browscap and change its path e.g from
browscap="\xampp\php\extras\browscap.ini" to
browscap="E:\xampp\php\extras\browscap.ini" - Save the file and restart the xampp
- 转到您的 xampp\php\php.ini
- 按 ctrl+f 找到 extension_dir 并将其相对路径更改为绝对路径,例如从 extension_dir="\ext" 到 extension_dir="E:\xampp\php\ext"
- 按 ctrl+f 找到 browscap 并更改其路径,例如从
browscap="\xampp\php\extras\browscap.ini" 到
browscap="E:\xampp\php\extras\browscap.ini" - 保存文件并重启xampp
try again with the composer installer
使用 Composer 安装程序重试
回答by Robert
For the sake of google indexing,
为了谷歌索引,
I write the error I had
我写了我的错误
If Composer doesn't install in windows 7, 8, 10 with php provided in the xampp installation with this error message
如果 Composer 未在 Windows 7、8、10 中安装,且 xampp 安装中提供的 php 出现此错误消息
The PHP exe file you specified did not run correctly: yourPathTo\php.exe
您指定的 PHP exe 文件未正确运行: yourPathTo\php.exe
The program failed to run correctly. Try reinstalling the program to fix this problem. Make sure you have installed the appropriate Visual C++ Redistributable.
程序未能正确运行。尝试重新安装程序以解决此问题。确保您已安装适当的 Visual C++ Redistributable。
The Composer message really confused me for the part of Visual C++, in fact it was not the case
Composer 消息真的让我对 Visual C++ 的部分感到困惑,事实上并非如此
Well, after long searches, I finally have found the Sarim' solution that you find in this same thread Composer setup installation error
好吧,经过长时间的搜索,我终于找到了您在同一线程Composer setup 安装错误中找到的 Sarim 解决方案
This specific issue is due to the php.ini which is default provided by the xampp installation which as highlighted by Sarim, does have paths relative to xampp installation and won't allow Composer-Setup.exe to properly run.
这个特定问题是由于 php.ini 是由 xampp 安装默认提供的,正如 Sarim 突出显示的那样,它确实具有相对于 xampp 安装的路径,并且不允许 Composer-Setup.exe 正确运行。