简体   繁体   中英

Cannot install Composer with Xampp on Windows

I've been trying to install composer with XAMPP on Windows 10 and the installer gave the following error:

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 setting in your php.ini could be causing the problem: Either the 'extension_dir' value is incorrect or the dll does not exist.

Program Output:
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_12c.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_pdo_oci.dll' - The specified module could not be found.
 in Unknown on line 0

The path to php.exe is already correct and I've uncommented the extensions on php.ini.

/php/ext 中的文件

/php/ext 中的文件 (2)

Thank you, and I wish you guys a good day!

If you are using portable XAMPP then you will get similar PHP warning. follow the instruction below to solve the warnings:

Open php.ini

  1. to solve extension dir and extension related warning simply change the extension_dir = "\\xampp\\php\\ext" to extension_dir = "./ext"

  2. to solve PHP Warning: Cannot open '\\xampp\\php\\extras\\browscap.ini' for reading in Unknown on line 0 zend_mm_heap corrupted

Change: browscap = "\\xampp\\php\\extras\\browscap.ini" to browscap = "[directory]:\\xampp\\php\\extras\\browscap.ini"

I had the same problem. When I wanted to install composer with XAMPP give me an error with a variable PHPRC was not correct and also I had a problem with the variable "extension_dir =". I solved like this:

  1. Change the variable PHPRC which is in "Environments Variables" of windows. I had C:\\Program Files\\PHP, I change by C:\\Program Files\\XAMPP\\php. (Probably because I had installed before other versions of PHP as Bitnami).

  2. In the file php.ini which is in C:\\Program Files\\XAMPP\\php folder, I open the file I had "extension_dir = ".ext/" and I changed by ' extension_dir = "C:\\Program Files\\XAMPP\\php\\ext" ' aim to the folder "EXT" which contains all DLL of PHP.

I know, I am too late hare but if anybody still looking for the answer here it is...

  • Go to your xampp\\php\\php.ini
  • Press ctrl+f to find extension_dir and change its relative path to absolute path eg from extension_dir="\\ext" to extension_dir="E:\\xampp\\php\\ext"
  • Press ctrl+f to find browscap and change its path eg from
    browscap="\\xampp\\php\\extras\\browscap.ini" to
    browscap="E:\\xampp\\php\\extras\\browscap.ini"
  • Save the file and restart the xampp

try again with the composer installer good luck with it...


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 again to install composer.

I have found the solution myself. It appears that the Composer is incompatible with php 7.0.0. I downloaded and installed Xampp with PHP 5.6.0 in it and now the installation is successful.

作曲家

In the next step, you would need php.exe path to proceed with the composer setup and provide the path of php.exe

Xampp 中的 PHP

After installing the composer, you must enable the extension (php_intl.dll) in your php.ini file. To enable the extension, go to your php.ini and uncommenting the line “extension=php_intl.dll” or without dll and just remove semicolon “;” from the starting of the line and restart your XAMPP control panel.

That's how you do it.

Reference: https://www.cloudways.com/blog/how-to-install-magento-2-on-localhost/

I got here for a almost similar issue.

The problem was I installed XAMPP in Program Files, and it sounds like it's not properly handled.

I reinstalled XAMPP at the root of C: (default installer configuration) and composer now works like a charm with PHP7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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