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

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


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.


I had the same problem, I kept repeating the composer installation until it was resolved this way:

1) Download the composer installer (.exe) and put it on C:/XAMPP.

2) Run the installer by just clicking next till the end.

3) Open command-line (cmd) and cd to your project directory (C:/XAMPP/htdocs/myproject) and type composer and see if you have it installed.

4) It should work now, let's say you want to install a PHP framework from your project directory: cmd=>composer require slim/slim "^3.0".