Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'composer' is not recognized as an internal or external command in windows server

Tags:

I am using windows server 2008 os. i download composer setup.exe and install to my PC . when I try composer install . I getting an error:

'composer' is not recognized as an internal or external command,

eg:-

c:\xampp\htdocs\shop>composer install
'composer' is not recognized as an internal or external command,
operable program or batch file.

My environment variable PATH is shown below:

C:\xampp\php\;C:\Users\Administrator\AppData\Roaming\Composer\vendor\bin
like image 205
danish dani Avatar asked Sep 27 '16 12:09

danish dani


People also ask

How do I fix composer not found?

If reinstalling Composer using official commands doesn't work, you may try directly running composer-setup. php with the default --install-dir and --filename argument. The composer-setup. php can be downloaded from https://getcomposer.org/installer.

How do you check if the composer is installed or not in cmd?

You can check your installed composer version using a command composer -v at the current path. Such as: composer -v.


1 Answers

For anyone coming here from Google who are facing the same issue. I just managed to solve this issue after all the other "solutions" other people suggested didn't work.

I installed Composer properly and the Environment variable was set but it just wouldn't work.

In my case composer is installed in C:\ProgramData\ComposerSetup\bin and this is exactly what is in my PATH Environment variable. After messing around a bit trying to fix it I saw that under System variables under PATH there is something called PATHEXT I opened that and added ;.PHAR to the end of it. So it ended up like this:

enter image description here

And this is what my PATH is now: enter image description here

I closed all file explorer windows and command prompts and started a new CMD and ran composer --version and it worked!

I hope this helps someone facing the same issue as me.

like image 70
Mahan_F Avatar answered Sep 27 '22 18:09

Mahan_F