Home >Development Tools >composer >Solution to the invalid composer command under windows
The following tutorial column of composer will introduce to you the solution to the problem that composer cannot be installed or the composer command is invalid under windows. I hope it will be helpful to friends in need!
Composer-Setup.exe
the command is invalid, as shown below: C:\ProgramData\ComposerSetup\bin
composer -v
. If the following is displayed, the installation is successful and can be accessed globally. composer -v
, the installation is successful as shown below. Installation command
Manual installation failed, as shown below: PHP version 5.6
and aboveinstallation directory
(you can create and specify it yourself ), for example: C:\Users\username>cd D:
Switch to D drive
C:\Users\username>cd D:\Composer
Switch to the Composer folder (the installation directory you created)
D:\Composer>php -r "readfile('https://getcomposer.org/installer' );" | php
Execute the installation command. From this step onwards, it is the same as the tutorial in the official document. Please check it yourself to complete the subsequent operations.
The file path after the installation is completed. At this time, the composer -v
command can only be executed in this directory, that is, it can only be locally accessed.
.
To global access
, you need to configure the system environment variables yourself and add the Path variable: D:\Composer
(Please modify it according to your own installation directory)
The above is the detailed content of Solution to the invalid composer command under windows. For more information, please follow other related articles on the PHP Chinese website!