简体   繁体   English

安装 Composer - 内部错误

[英]Installing Composer - Internal Error

I have trouble installing Composer .我在安装Composer遇到问题。 After I select the php.exe path in the wizard and next thing it shows is the below error description.在向导中选择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.您指定的 PHP exe 文件未正确执行: D:\wamp\bin\php\php5.5.12\php.exe 从命令行运行它可能会突出问题。 Internal Error [ERR_INVALID], exit code 1内部错误 [ERR_INVALID],退出代码 1

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.ini located in your "php" folder In my case it is in xampp the file is in c:\xampp\php\查找并打开位于“php”文件夹中的php.ini在我的情况下,它位于 xampp 中,文件位于c:\xampp\php\
  2. Find "extension=php_openssl.dll"找到"extension=php_openssl.dll"
  3. ";extension=php_openssl.dll" uncomment by removing the semicolon ";" ";extension=php_openssl.dll"通过删除分号";"取消注释
  4. Restart your xampp , now extension should be loaded after that.重新启动您的 xampp ,现在应该在此之后加载扩展程序。
  5. Try again now you are able to install 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.ini located in your "php" folder In my case it is in xampp the file is in c:\xampp\php\查找并打开位于“php”文件夹中的php.ini在我的情况下,它位于 xampp 中,文件位于c:\xampp\php\
  2. Open SHELL from Xampp start panel by clicking on shell button.通过单击 shell 按钮从 Xampp 开始面板打开 SHELL。
  3. Write php in shell and hit enter在 shell 中编写php并回车
  4. If you get some warning message in your shell that looks like the image below:如果您在 shell 中收到如下图所示的警告消息: 在此处输入图像描述
  5. Then you have to fix these warning 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 in php.ini file to solve the issue).然后你必须通过在你的php.ini文件中注释所有这些扩展来修复这些警告消息。(实际上这些警告消息的原因是因为不止一次启用了这些扩展,但你可以在php.ini文件中取消注释它以解决问题)。

    For Example which is in my case.例如,在我的情况下。

    a).一个)。 You can see in above image there is warning message for curl.您可以在上图中看到 curl 的警告消息。

     Module 'curl' already loaded in Unknown on line 0 .

    b) To fix this find php_curl.dll file in your php.ini file and comment that extension by adding semicolon ";" b) 要解决此问题,请在php.ini文件中找到php_curl.dll文件并通过添加分号";"来注释该扩展名in front of that extension like this ;extension=php_curl.dll在像这样的;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.重新启动您的 xampp ,现在应该在此之后加载扩展程序。
  2. Try again now you are able to install composer.现在再试一次,您就可以安装作曲家了。

Hope I can solve your issue .希望我能解决你的问题。

That's all folks .就是这样。 Happy coding !!!编码快乐!!! (amitamie.com) :-) ;-) (amitamie.com) :-) ;-)

There are some steps you might want to follow in order to solve your problem为了解决您的问题,您可能需要执行一些步骤

  1. You can try to change extension_dir in xampp\php\php.ini to full direction like :您可以尝试将xampp\php\php.ini中的extension_dir更改为完整方向,例如:

     extension_dir = "E:\xampp\php\ext"
  2. Install it manually Is there any way to install Composer globally on Windows?手动安装有没有办法在 Windows 上全局安装 Composer? or you can do it by open XAMPP Shell and write this或者你可以通过打开 XAMPP Shell 并编写这个来做到这一点

    php -r "readfile('https://getcomposer.org/installer');" | php
  3. Just install it in C:\ partition, I think it will work .只需将它安装在C:\分区中,我认为它会工作。

I think the problem its in the Windows8 and above that not give Full permission to use CMD .我认为问题在于 Windows8 及更高版本没有完全允许使用CMD

This worked for me..,这对我有用..,

  1. Open xampp>apache>PHP(php.ini)打开 xampp>apache>PHP(php.ini)
  2. Search for openssl搜索openssl
  3. Comment on extension=openssl by adding ;通过添加评论 extension=openssl ; at the beggining一开始

You are getting this error because some dll file which is specified in the php.ini is missing.您收到此错误是因为缺少 php.ini 中指定的某些 dll 文件。 So do the following steps to fix it.因此,请执行以下步骤来修复它。

  1. Open command prompt and type php and hit enter.打开命令提示符并输入php并回车。

  2. It will try to execute php and will throw warnings and errors.它将尝试执行 php 并抛出警告和错误。 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.现在,根据错误,继续并在 php.ini 文件中注释扩展名(在上面的命令中列出)。 For example in my case I commented extension=php_mysql.dll to ;extension=php_mysql.dll例如,在我的情况下,我将extension=php_mysql.dll 注释为 ;extension=php_mysql.dll

  4. Now try to install the composer again, it should work.现在尝试再次安装作曲家,它应该可以工作。

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.注意:一旦你安装了作曲家,你可以继续并取消你评论过的所有行。

There's following step you have to made.您必须执行以下步骤。

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

;extension=php_openssl.dll ;扩展=php_openssl.dll

add semi-colon in first and retry again to install composer首先添加分号,然后重试以安装作曲家

This works for me.这对我有用。

  1. Go to Drive_name://xampp/php转到Drive_name://xampp/php
  2. Open php.ini and search for "msql.so" and "msql.dll"打开 php.ini 并搜索“msql.so”和“msql.dll”
  3. Change extension=msql.dll to ;extension=msql.dll and extension=msql.so to ;extension=msql.soextension=msql.dll更改为;extension=msql.dll并将extension=msql.so;extension=msql.so

This worked for me!这对我有用!

  1. Go to path/to/xampp/php and open php.ini转到path/to/xampp/php并打开php.ini
  2. Search for extension=php_mcrypt.dll and comment that by putting semicolon (;) .搜索extension=php_mcrypt.dll并通过输入分号(;)对其进行注释。 Like Replace extension=php_mcrypt.dll With ;extension=php_mcrypt.dll就像将extension=php_mcrypt.dll替换为;extension=php_mcrypt.dll
  3. Save php.ini保存php.ini

    Now Try to install composer again and it should work OK.现在尝试再次安装composer ,它应该可以正常工作。

Go to your xampp\php\php.ini转到您的xampp\php\php.ini

Press Ctrl + f to find extension=intl and comment it out using ;Ctrl + f找到extension=intl并使用;将其注释掉

;extension=intl

Try and install your composer.exe.尝试安装您的 composer.exe。

This worked for me when I got this error: The PHP exe file you specified did not run correctly: C:\xampp\php\php.exe当我收到此错误时,这对我有用:您指定的 PHP exe 文件未正确运行:C:\xampp\php\php.exe

Program Output: PHP: syntax error, unexpected '(' in C:\xampp\php\php.ini on line 1602,程序输出:PHP:语法错误,第 1602 行 C:\xampp\php\php.ini 中出现意外的 '(',

After trying all the above answers: I open the php.ini file with a code editor and located line 1602 and I saw在尝试了以上所有答案之后:我用代码编辑器打开 php.ini 文件并找到第 1602 行,我看到了

error_reporting(1) around the eval().

so I commented on it using ;所以我用 ; 评论它

;error_reporting(1) around the eval().

and my composer installed successfully.我的作曲家安装成功。

There's no two ways about it.没有两种方法。 Just go to PHP.ini and comment the mention errors you have on your cmd or shell after typing PHP in it.simple as that problem solved.只需转到 PHP.ini 并在其中键入 PHP 后在 cmd 或 shell 上注释您提到的错误。这个问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM