Your first local website
In this tutorial, we’ll start MAMP for the first time, confirm that the local web server is working, and create a simple PHP page that runs in your browser. By the end you’ll understand how files get from your Mac to a web browser without any internet connection.
What you need:
- MAMP installed on your Mac (see Installation)
- A plain-text editor – TextEdit (built into macOS), Visual Studio Code, or any other editor
What you’ll learn:
- How to start and stop MAMP’s servers
- Where to put your web files (the document root)
- The difference between a static HTML page and a PHP page
Part 1: Start your local server
Section titled “Part 1: Start your local server”-
Open MAMP.
Open Finder, go to Applications › MAMP, and double-click MAMP (not MAMP PRO).

The MAMP window opens. The toolbar shows Settings, Cloud, WebStart, and Start – plus PRO Tour and Try PRO which you can ignore for now. The Start button on the right is the one we need. The servers are not running yet.
-
Start the servers.
Click the Start button in the top-right of the toolbar. MAMP may ask for your administrator password.

Once both servers are running, the button changes to Stop and its icon turns green. WebStart becomes active. You now have a local Apache web server and a MySQL database server running on your Mac.
-
Confirm the server is working.
Open your browser and go to:
http://localhost:8888
The address
http://localhost:8888is your local web server. Port 8888 is the default MAMP uses so it doesn’t conflict with other software on your Mac.
Part 2: Create your first HTML page
Section titled “Part 2: Create your first HTML page”The web server serves files from a specific folder on your Mac called the document root. Anything you put in that folder is accessible in the browser.
-
Find the document root.
Look at the Document root field in the MAMP main window. The default path is:
/Applications/MAMP/htdocsOpen this folder in Finder: choose Go › Go to Folder… from the menu bar, paste the path, and press Return. You’ll see a file called
index.php– that’s the “Welcome to MAMP” page you just saw in your browser. -
Create a new HTML file.
Open your text editor. If you’re using TextEdit, choose Format › Make Plain Text first (otherwise it saves as RTF, which won’t work).
Type the following, exactly as shown:
<!DOCTYPE html><html><head><title>My first local website</title></head><body><h1>Hello, MAMP!</h1><p>My local web server is working.</p></body></html> -
Save the file to the document root.
Save the file as
hello.htmlinside/Applications/MAMP/htdocs/.Make sure the filename ends in
.html, not.html.txt. In TextEdit, type the full name including the extension in the save dialog and confirm when asked to keep the.htmlending. -
Open the page in your browser.
Go to your browser and navigate to:
http://localhost:8888/hello.html
Part 3: Add PHP
Section titled “Part 3: Add PHP”HTML pages are static – they look the same every time. PHP lets the server calculate and generate content dynamically. We’ll make a minimal PHP page to see this in action.
-
Create a PHP file.
Back in your text editor, create a new file and type:
<!DOCTYPE html><html><body><h1>Hello from PHP!</h1><p>Today is: <?php echo date('l, F j, Y'); ?></p><p>PHP version: <?php echo phpversion(); ?></p></body></html> -
Save it as
hello.php.Save the file as
hello.phpin the same folder:/Applications/MAMP/htdocs/. -
Open the PHP page in your browser.
Navigate to:
http://localhost:8888/hello.php
You’ll see today’s date (written out in full) and the PHP version number. These values were calculated by PHP on your server the moment you requested the page – they weren’t in the file you wrote.
What you’ve learned
Section titled “What you’ve learned”- MAMP runs a local Apache web server and a MySQL database server on your Mac.
- Files in
/Applications/MAMP/htdocs/are served athttp://localhost:8888/. - Static
.htmlfiles are sent directly to the browser. PHP files are processed by the server first. - You can stop the servers any time by clicking Stop in MAMP – your files stay in place.
Where to go next
Section titled “Where to go next”- MAMP Interface – a reference overview of the MAMP interface (toolbar, preferences, all options)
- How-to guides – practical guides for specific tasks, like installing WordPress or changing the PHP version
- Settings – change ports, the document root, MySQL version, and more