• Skip to primary navigation
  • Skip to main content

Ishan Sharma

Full Stack Engineer, Blogger, Student

  • Blog
  • Contact
  • About

[Windows Issue] php.exe works but php doesn’t? Here’s the fix!

Programming · February 21, 2015

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.

Share this:

  • Twitter
  • Facebook
  • Reddit
  • More
  • Email
  • Print
  • LinkedIn
  • Pocket
  • Pinterest
  • Tumblr

Filed Under: Programming

Ishan

I am a Software Engineer and Writer. Interested in design, AI and drawing. When free, mostly found reading or gaming.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © 2021

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.