Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Installing Composer

I tried to download Composer via the Command Prompt as the Composer website says to. I receive a 'php' is not recognized as an internal or external command, operable program or batch file. What does this mean? How can I fix this?

2 Answers

nico dev
nico dev
20,364 Points

Hi Joshua Hardy ,

You sure you installed PHP first? If so, maybe you didn't add it to the path? What is your OS?

Windows 10...I just did that. I have it in my MAMP file. Is there a particular place that I should put it in the MAMP file?

When I try to set up composer, I still get a 'Choose the command-line PHP you want to use:'. Then there is a drop down bar with no options. But there is a browse button to the right.

nico dev
nico dev
20,364 Points

Well, you got me there, I don't use MAMP at all.

However, I am pretty sure that MAMP brings the php built-in. If so, all you need should be to locate the php folder there, and then go to your Windows Search, type 'environments' or similar, it will bring you the options Edit the system environment variables, there's also an option Edit the environment variables for your account and other stuff. Choose the former.

Once there, click Environment variables, and then at the bottom, under System variables, select Path, and click on Edit. Now, click New, and copy-paste the path of your php folder. Mine, for example, is simply C:\php but yours, being in MAMP, will surely be different (once you're in your php folder in Windows Explorer, just right-click in the address bar and select the first option, Copy address, then paste it there).

Then, don't forget to click OK and close each one of the environment variables windows open, and then you should be good to go. A good way to test it's working would be to open your command prompt, Git, or whichever console you prefer to use, and type simply:

php -v

This should give you a message with your version of php, and it also means it's already recognized as an 'authorized' command in the command prompt, so you can use it now.

HTH!