Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Ulrike Pechmann18,211 Points
With this Video i setup mamp. But how am i going to get to the console on my local mamp-Server?
I simply dont know how i make myself able to run .php files from the console like in workspaces. Where to find the console in a local dev environment like mamp?
Once you are running mamp you go into your browser and type
into the address bar. sometimes this is followed by the port like:
then you would follow it by the directory of your website in your htdocs.
localhost/website or localhost:8080/website
As long as you have started your php server in mamp youre ready to go. Take the steps that Anton said. Locate the file directory ex in Mac: Application->mamp->htdocs, As long as you have a php file in there you can run it directly from your browser as Anton mentioned.
Hi! This might come a tad late for Ulrike, but maybe someone else has stumbled into this issue.
Since MAMP comes with PHP bundled, it is possible to use this PHP version from the Windows Command Prompt. All you need to do is to tell Windows were PHP is located:
- Download MAMP and install it.
- Locate the subdirectory with the PHP package. For the default installation path, this is
C:\MAMP\bin\php. There are multiple PHP packages in there. I recommend choosing the newest one. At the time of this writing, this is
- Copy the full path in which the
php.exeis located. For the above example:
- Now, this path needs to be added to the
PATHenvironment variable. The Command Prompt uses the
PATHto look for
php.exewhen you type
phpin the prompt. This article does a good job at describing how to accomplish that for your version of Windows.
- Once you've done that, open a Command Prompt (Windows Key + R, then type
cmd). Note: You need to open a new prompt. Don't use a prompt that's already open. It cannot detect that you changed the
- Now, type
php --version. If you did everything correctly, you should now see the php version printed. Something like
PHP 7.1.7 (cli) (built: Jul 25 2017 09:24:45) ( ZTS MSVC14 (Visual C++ 2015) x86 ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
- PHP files can be run just like in the Workspace:
php filename.php, where
filename.phpis the file you want to run. You just have to navigate to a folder were you have php files, or create one in the location were the Command Prompt is open at (The location is displayed at the start of the command line, e.g.
If working with the command line is new to you, this article might be a good starting point.
Good luck, and happy programming!