I just lost 47% of my hair trying to figure out a simple problem.

All this for a simple 2 minute solution.

I wanted to run composer and for that, I wanted to install PHP manually. (There’s no need to. As far as I have read, it should work well with WAMP packages like EasyPHP and WAMP Server).

So, I diligently followed the simple instructions, installed composer. Typed composer to run it and bam, powershell threw this error message at me:

The system can't find the path specified.

I wasn’t ready for that! So, I checked the instructions again and added PATH correctly. Still, same result. Searched a lot for composer issues and that didn’t help much.

Then I tried running php and boom, again same error message. Good! Now I knew that the problem was with PHP and not composer.

I went back, read the PHP instructions for installation and did everything correctly. Here are the instructions:

  1. PHP Manual Installation Steps
  2. Command Line PHP

Finally, I stumbled upon a helpful Stack Overflow answer.

Here’s how the issue got resolved:

  1. I did where php in command line.
  2. Found that there were two more paths in the PATH variable. (I had added them for another package).
  3. Removed extra paths, updated PATH

And PHP worked.

Finding extra or wrong path in PATH can be hard to troubleshoot. Hopefully this post will help you.