Skip to content
MAMP Documentation

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

  1. Open MAMP.

    Open Finder, go to Applications › MAMP, and double-click MAMP (not MAMP PRO).

    The MAMP window with servers not yet running. The toolbar shows Settings, PRO Tour, Try PRO, Cloud, WebStart, and Start. The main area displays Name, Document root, Web server, and PHP version.

    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.

  2. Start the servers.

    Click the Start button in the top-right of the toolbar. MAMP may ask for your administrator password.

    The MAMP window with servers running. The button in the top-right now reads "Stop" and its icon is green. The WebStart button is now active.

    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.

  3. Confirm the server is working.

    Open your browser and go to:

    http://localhost:8888

    Browser showing the MAMP welcome page at localhost. The page reads "Welcome to MAMP – If you can see this page, MAMP has been properly configured & launched." It also shows server details: Apache version, document root, and PHP version.

    The address http://localhost:8888 is your local web server. Port 8888 is the default MAMP uses so it doesn’t conflict with other software on your Mac.


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.

  1. Find the document root.

    Look at the Document root field in the MAMP main window. The default path is:

    /Applications/MAMP/htdocs

    Open 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.

  2. 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>
  3. Save the file to the document root.

    Save the file as hello.html inside /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 .html ending.

  4. Open the page in your browser.

    Go to your browser and navigate to:

    http://localhost:8888/hello.html

    Browser showing hello.html at localhost/hello.html. The page displays "Hello, MAMP!" as a heading and "My local web server is working." as a paragraph.


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.

  1. 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>
  2. Save it as hello.php.

    Save the file as hello.php in the same folder: /Applications/MAMP/htdocs/.

  3. Open the PHP page in your browser.

    Navigate to:

    http://localhost:8888/hello.php

    Browser showing hello.php at localhost/hello.php. The page displays "Hello from PHP!" as a heading, followed by today's date and the PHP version number.

    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.


  • MAMP runs a local Apache web server and a MySQL database server on your Mac.
  • Files in /Applications/MAMP/htdocs/ are served at http://localhost:8888/.
  • Static .html files 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.
  • 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