Setting up the MAMP PHP/MySql Environment on Windows

We will install the MAMP bundled PHP/MySql system. Installing the MAMP (or similar) bundle is much easier than installing all the components separately.

Pre-Requisite: VSCode or some other Programming Editor

Installing MAMP

There is a screen cast of this process below on YouTube. You can watch the screen cast and follow along to complete the tasks. There are notes below the YouTube video as well. You may want to print this page to have the notes as you follow the steps in the video.

Installation Notes

Download the installation package from:
Assuming you are using the Microsoft browser, it will download and automatically start the installer for you. We can accept all the defaults, but you might not want to install MAMP Pro so it does not nag you to upgrade.

The installer has placed MAMP on your Desktop, so you can clck on it to launch it.

When MAMP starts you should see a control panel. Press "Start Servers" if they are automatically started. Be patient, these things can take a moment.

The first time you start the server, Windows will ask you to verify that Apache and MySQL are indeed allowed to use the network ports to receive traffic. If you do not see these messages, you may need to run the installation as an administrator.

You should see two indicators that both the Apache and MySQL servers were started successfully.

Then press the "Open start page" to show the MAMP configuration screen. The start page is located at http://localhost/MAMP/ and it is generally the way you work with MAMP and MySql.

Your First PHP Program

Open a text editor (i.e. VSCode) and put the following text in the file putting your own name in instead of mine:

<h1>Hello from Dr. Chuck's HTML Page</h1>
We will start simple and since PHP is simply an extension of HTML, our first program is just an HTML file.

Save this file as:

Create the folder first under the htdocs folder when you save the file.

Once you have saved this file, navigate your browser to:


And you should see your web page in your browser.

Once that works, lets add a little PHP to our HTML. Change your file to be as follows and re-save:

<h1>Hello from Dr. Chuck's HTML Page</h1>
   echo "Hi there.\n";
   $answer = 6 * 7;
   echo "The answer is $answer, what was the question again?\n";
<p>Yes another paragraph.</p>
After you save, press "Refresh" in your browser and it should appear as follows:

Congratulations, you have written your first PHP program.

Displaying Syntax Errors

MAMP usually comes configured by default not to display error detail when you make a mistake in your PHP code. This is an appropriate setting for production servers but very inconvienent when developing PHP code.

The solution is to find and edit the php.ini file that controls the XAMPP configuration, search for the setting display_errors and set the value to On and then restart your Apache server.

On MAMP the php.ini file is located here:

The "7.1.5" might be different on your system. You can always find where php.ini is by looking at your PHPInfo screen.

You should find and change the setting to be:
display_errors = On

Then you will need to stop and restart the Apache and MySQL servers using the MAMP, control panel and when you are done, you can use phpinfo check to make sure that your setting was successfully changed.

It is important that you change this setting right away or you will be rather confused when your PHP code fails and you never see any error message.