'The Composer installer script did not run correctly [exit code 1]
I tried to install Composer-php in Windows 10 by downloading the executable Composer-Setup.exe from getcomposer. When prompted during installation to chose the command-line PHP I wanted to use, I entered my path to PHP C:\WinNMP\bin\PHP\64bit-php-7.4\php.exe
But I got following error:
Script Output: PHP Warning: realpath(): open_basedir restriction in effect.
File(C:\Users\admin\AppData\Local\Temp\is-1KBL9.tmp) is not within the allowed path(s): (c:/winnmp) in C:\Users\admin\AppData\Local\Temp\is-1KBL9.tmp\installer.php on line 655 PHP Warning: is_writeable(): open_basedir restriction in effect. File(C:\Users\admin\AppData\Local\Temp\is-1KBL9.tmp) is not within the allowed path(s): (c:/winnmp) in C:\Users\admin\AppData\Local\Temp\is-1KBL9.tmp\installer.php on line 657
Solution 1:[1]
It looks like your php.ini
places restrictions on which directories are accessible with the open_basedir
option:
Limit the files that can be accessed by PHP to the specified directory-tree, including the file itself. [...]
When a script tries to access the filesystem, for example using include, or fopen(), the location of the file is checked.
You can run php -i
to find out where your php.ini
is located and then either disable/modify that option, e.g. make sure that C:\Users\admin\AppData\Local\Temp
is accessible.
Solution 2:[2]
In 90% of cases, the problem is the Windows Firewall
Turn off the Windows Defender Firewall when installing
Solution 3:[3]
In 90% of cases, the problem is the Windows Firewall. Turn off the Windows Defender Firewall when installing.
Solution 4:[4]
I disabled my firewall and solved this composer problem:
Script Output: The "https://getcomposer.org/versions" file could not be downloaded: php_network_getaddresses: getaddrinfo for getcomposer.org failed: No such host is known.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | dbrumann |
Solution 2 | younes |
Solution 3 | karel |
Solution 4 | Stephen Musyoka |