php 安装 Composer - 内部错误

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

Installing Composer - Internal Error

phpcomposer-php

提问by u5209943

I have trouble installing Composer. After I select the php.exepath in the wizard and next thing it shows is the below error description.

我在安装时遇到问题Composer。在php.exe向导中选择路径后,接下来显示的是以下错误描述。

The PHP exe file you specified did not execute correctly: D:\wamp\bin\php\php5.5.12\php.exe Running it from the command line might highlight the problem. Internal Error [ERR_INVALID], exit code 1

您指定的 PHP exe 文件未正确执行:D:\wamp\bin\php\php5.5.12\php.exe 从命令行运行它可能会突出显示问题。内部错误 [ERR_INVALID],退出代码 1

回答by Amit Kumar

I guess this is a problem which had been asked here .

我想这是一个在这里被问到的问题。

composer not install in windows 7

作曲家未安装在 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.

第一个解决方案。

  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 didn't work for you then go with one below. )

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

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 warning message in your shell that looks like the image below: enter image description here
  5. Then you have to fix these warning 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 to solve 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 until 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 Zaman

There are some steps you might want to follow in order to solve your problem

为了解决您的问题,您可能需要遵循一些步骤

  1. You can try to change extension_dirin xampp\php\php.ini to full direction like : extension_dir = "E:\xampp\php\ext"
  2. Install it manually Is there any way to install Composer globally on Windows?or you can do it by open XAMPP Shell and write this

    php -r "readfile('https://getcomposer.org/installer');" | php

  3. Just install it in (C:) partition I think it will work .

    I think the problem its in the Windows8 and above not allow Full permission to use CMD .

  1. 您可以尝试将extension_dirxampp\php\php.ini更改为完整方向,例如: extension_dir = "E:\xampp\php\ext"
  2. 手动安装 有没有办法在 Windows 上全局安装 Composer?或者您可以通过打开 XAMPP Shell 并编写此内容来完成

    php -r "readfile('https://getcomposer.org/installer');" | php

  3. 只需将其安装在 (C:) 分区中,我认为它会起作用。

    我认为问题在 Windows8 及更高版本中不允许使用 CMD 的完全权限。

回答by Manvendra Shrinetra

You are getting this error because some dll file which is specified in the php.ini is missing. So do the following steps to fix it.

您收到此错误是因为缺少 php.ini 中指定的某些 dll 文件。因此,请执行以下步骤来修复它。

  1. Open command prompt and type phpand hit enter.

  2. It will try to execute php and will throw warnings and errors. For example in my case it was like below: Error

  3. Now, based on the error, go ahead and comment the extension (listed in the above command) in php.ini file. For example in my case I commented extension=php_mysql.dllto ;extension=php_mysql.dll

  4. Now try to install the composer again, it should work.

  1. 打开命令提示符并输入php并按回车键。

  2. 它将尝试执行 php 并抛出警告和错误。例如,在我的情况下,它如下所示: 错误

  3. 现在,根据错误,继续注释 php.ini 文件中的扩展名(在上面的命令中列出)。例如,在我的情况下,我将 extension=php_mysql.dll 注释为 ;extension=php_mysql.dll

  4. 现在尝试再次安装作曲家,它应该可以工作。

Note:If not repeat the process again, may be there are more then one extensions in php.ini are creating the problem in your case, but at cmd, php might give only one error at once.

注意:如果不再次重复该过程,可能是 php.ini 中的多个扩展名在您的情况下造成了问题,但在 cmd 中,php 可能一次只给出一个错误。

Note:Once you have installed composer you can go ahead and uncomment all the line which you had commented.

注意:安装 composer 后,您可以继续取消注释所有已注释的行。

回答by Kashif Saleem

There's following step you have to made.

您必须执行以下步骤。

  1. Go to C://xampp/php
  2. open php.ini and search for "openssl" (Two search may Found!)
  1. 转到 C://xampp/php
  2. 打开 php.ini 并搜索“openssl”(可能会找到两次搜索!)

;extension=php_openssl.dll

;扩展= p​​hp_openssl.dll

add semi-colon in first and retry again to install composer

首先添加分号,然后重试以安装作曲家

回答by Md.Meherul Islam

This works for me.

这对我有用。

  1. Go to Drive_name://xampp/php
  2. Open php.ini and search for "msql.so" and "msql.dll"
  3. Change extension=msql.dllto ;extension=msql.dlland extension=msql.soto ;extension=msql.so
  1. Drive_name://xampp/php
  2. 打开 php.ini 并搜索“msql.so”和“msql.dll”
  3. 更改extension=msql.dll;extension=msql.dllextension=msql.so;extension=msql.so

回答by Robson Chico

回答by HaxxanRaxa

This worked for me!

这对我有用!

  1. Go to path/to/xampp/phpand open php.ini
  2. Search for extension=php_mcrypt.dlland comment that by putting semicolon (;). Like Replace extension=php_mcrypt.dllWith ;extension=php_mcrypt.dll
  3. Save php.ini

    Now Try to install composeragain and it should work OK.
  1. 前往path/to/xampp/php并打开php.ini
  2. extension=php_mcrypt.dll通过放置分号来搜索和评论(;)。像替换extension=php_mcrypt.dll;extension=php_mcrypt.dll
  3. php.ini

    立即保存尝试composer再次安装,它应该可以正常工作。