php 作曲家未安装在 Windows 7 中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22763452/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:14:55  来源:igfitidea点击:

composer not install in windows 7

phpwindowscomposer-php

提问by diangelisj

I already uncommented in php.ini:

我已经在 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:

PHP 版本 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
  • Windows 7的
  • 万普
  • php 5.1.16
  • 阿帕奇 2.4.4

How solve this problem, please help me.

如何解决这个问题,请帮助我。

回答by jtmielczarek

  1. Open php.ini located in your "php" folder for example in xampp the file is in XYZ:\xampp\php\

  2. Find "extension=php_openssl.dll"

  3. ";extension=php_openssl.dll"- remove ";"

  4. Restart your xampp (or whatever u use), extension should be loaded after that.

  5. Try agien to install composer.

  1. 打开位于“php”文件夹中的 php.ini,例如在 xampp 中,该文件位于 XYZ:\xampp\php\

  2. "extension=php_openssl.dll"

  3. ";extension=php_openssl.dll"- 消除 ";"

  4. 重新启动您的 xampp(或您使用的任何东西),之后应该加载扩展。

  5. 尝试使用 agien 安装 Composer。

回答by Kiee

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.dllis enabled but doing just that sometimes may not resolve the error.

如前所述,您需要确保extension=php_openssl.dll已启用,但这样做有时可能无法解决错误。

You should check that you have PHP on your path variable then see what INI file is loaded by typing php --iniin the console it should give you something like:

你应该检查你的路径变量上是否有 PHP,然后通过php --ini在控制台中输入来查看加载了哪些 INI 文件,它应该给你类似的信息:

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.

确保您在正确的 ini 文件中启用设置。如果您没有加载 ini 文件,请将 php 目录中的 ini 文件放入c:\windows.

Also importantI find it helps to change the extension_dirflag to an absolute path from relative to makesure the system can find php_opensll.dll.

同样重要的是,我发现将extension_dir标志从相对路径更改为绝对路径有助于确保系统可以找到php_opensll.dll

To do this uncomment the line starting extension_dirand change it to match from the drive root.

为此,取消注释开始的行extension_dir并将其更改为与驱动器根目录匹配。

Example: C:\php\extinstead of ext/

示例:C:\php\ext代替ext/

回答by BrianPando

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,

确保您正在编辑位于 php.exe 的同一位置的 php.ini,我遇到了同样的问题,wamp 说 openssl 已激活,但 Composer-Setup.exe 使用了 php 目录/ext/ 和 wamp 中的 php.ini使用 C:\System...\php.ini,

Regards,

问候,

回答by Damir Olejar

For MAMP users, this is what worked for me.

对于 MAMP 用户,这对我有用。

If your php.ini is located under a \MAMP\conf\

如果您的 php.ini 位于 \MAMP\conf\

  1. copy the php.ini into a\MAMP\bin\php\php[your PHP version number]\
  2. Restart MAMP and the command-line window
  3. Go to a directory under a command-line window where you want to install composer
  4. run from a command line: php -r "readfile('http://getcomposer.org/installer');" | php
  1. 将 php.ini 复制到 a\MAMP\bin\php\php[您的 PHP 版本号]\
  2. 重新启动 MAMP 和命令行窗口
  3. 转到命令行窗口下要安装 composer 的目录
  4. 从命令行运行: php -r "readfile(' http://getcomposer.org/installer');" | php

NOTE: it is http not https !

注意:它是 http 而不是 https !

END

结尾

回答by Amit Kumar

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.

第一个解决方案。

  1. Find and Open php.inilocated in your "php" folder In my case it is in xampp the file is in c:\xampp\php\
  2. Find "extension=php_openssl.dll"
  3. ";extension=php_openssl.dll"uncomment by removing the semicolon";"
  4. Restart your xampp , now extension should be loaded after that.
  5. Try again now you are able to install composer.
  1. 查找并打开php.ini位于您的“php”文件夹中在我的情况下,它在 xampp 中,文件在c:\xampp\php\
  2. "extension=php_openssl.dll"
  3. ";extension=php_openssl.dll"通过删除分号取消注释";"
  4. 重新启动您的 xampp ,现在应该在此之后加载扩展。
  5. 现在再试一次,您就可以安装 Composer 了。

2nd solution(If the above solution not work for you then go with below solution . )

第二种解决方案(如果上述解决方案不适合您,请使用以下解决方案。)

This works in my case

这在我的情况下有效

  1. Find and Open php.inilocated in your "php" folder In my case it is in xampp the file is in c:\xampp\php\
  2. Open SHELL from Xampp start panel by clicking on shell button.
  3. Write phpin shell and hit enter
  4. If you get some waring message in your shell something like below . enter image description here
  5. Then you have to fix these waring message by commenting all these extension in your php.inifile.(Actually cause of these warning messages are because more than one time these extensions are enabled but you can un-commentit in php.inifile 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.dllfile in your php.inifile and comment that extension by adding semicolon";"in front of that extension like this ;extension=php_curl.dll

  1. 查找并打开php.ini位于您的“php”文件夹中在我的情况下,它在 xampp 中,文件在c:\xampp\php\
  2. 通过单击 shell 按钮从 Xampp 开始面板打开 SHELL。
  3. php在 shell 中写入并按 Enter
  4. 如果您在 shell 中收到一些警告消息,如下所示。 在此处输入图片说明
  5. 然后您必须通过在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 中没有收到任何警告消息。

  1. Restart your xampp , now extension should be loaded after that.
  2. Try again now you are able to install composer.
  1. 重新启动您的 xampp ,现在应该在此之后加载扩展。
  2. 现在再试一次,您就可以安装 Composer 了。

Hope I can solve your issue .

希望我能解决你的问题。

That's all folks . Happy coding !!! (amitamie.com) :-) ;-)

这就是所有的人。快乐编码!!!(amitamie.com) :-) ;-)

回答by diangelisj

The problem solved after turn off windows firewall.

关闭windows防火墙后问题解决。

installation complete!

安装完成!

回答by Chirag Parekh

You can follow this guide:

您可以按照本指南进行操作:

http://abuango.net/2014/08/16/how-to-install-composer-on-windows-with-xampp/

http://abuango.net/2014/08/16/how-to-install-composer-on-windows-with-xampp/

Hope it helps you.

希望对你有帮助。

回答by Aleksander Zaytsev

  1. Find a php.iniin C:\wamp\bin\php\php5.4.16\(the configuration file of PHP).
  2. Remove ;in lines ;extension=php_openssl.dlland ;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).
  3. Run the Windows command prompt with administrator permissions.
  4. Execute the following command: mklink C:\Windows\php.ini C:\wamp\bin\php\php5.4.16\php.ini
  1. 找一个php.iniin C:\wamp\bin\php\php5.4.16\(PHP的配置文件)。
  2. 删除;;extension=php_openssl.dll;extension_dir = "ext"。PHP 会知道你使用的是 php_openssl 扩展,extension_dir 是扩展的位置(你可以在 php_openssl 上面的注释中看到它)。
  3. 使用管理员权限运行 Windows 命令提示符。
  4. 执行以下命令: mklink C:\Windows\php.ini C:\wamp\bin\php\php5.4.16\php.ini

Composer search php.iniin C:\Windows\php.iniand you have your PHP in WAMP. With mklinkcommand you create a link php.inithat aim to your WAMP's php.ini.

在 Composer 中搜索php.iniC:\Windows\php.ini您就可以在 WAMP 中找到您的 PHP。使用mklink命令,您可以创建一个指向php.iniWAMP 的链接php.ini

回答by PaulSchell

I nearly wrapped my head off trying to install composer on my windows 7 machine.

试图在我的Windows 7 机器上安装 Composer 时,我几乎把我的头打断了。

I was trying to install composer through the composer installer from getcomposer.org.

我试图通过 getcomposer.org 的 composer installer 安装 composer。

After the common openssl extension enabling (As above answers describing).

在启用常见的 openssl 扩展后(如上面的答案所述)。

The installer has finished the installation successfully. But calling composer on the command line, wasnt possible. It was telling me composer / applicationnot found, check for typos etc...

安装程序已成功完成安装。但是在命令行上调用composer 是不可能的。它告诉我找不到作曲家/应用程序,检查拼写错误等...

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.

我在 Composer 安装过程中打开了一个终端窗口。之后,我尝试通过此终端中的命令行调用 composer。这没有用。

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.

那么为什么它不起作用呢?composer 安装程序下载 composer.phar 文件并为其设置环境路径。终端仅在启动时获取环境 PATHS。所以当然没有为终端设置路径。

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!!!

如果您在安装前打开了一个终端,只需关闭它并打开一个新的终端窗口即可让 Composer 准备好使用!!!

I hope I can save someone a couple hours of living time.

我希望我可以为某人节省几个小时的生活时间。

回答by Devasish

Beside all of the above If php/xampp is not installed in c drive this problem occurred (what happened with me).

除了以上所有如果 php/xampp 未安装在 c 驱动器中,则会出现此问题(我发生了什么)。

In that case please follow this link : http://abuango.net/2014/08/16/how-to-install-composer-on-windows-with-xampp/

在这种情况下,请点击此链接:http: //abuango.net/2014/08/16/how-to-install-composer-on-windows-with-xampp/