Set up a localhost and make a web page using MAMP and PHP


By the current time, MAMP had released a version for Windows. This helps Windows users have one more option set up an Apache localhost easily. So that, you can focus on coding some PHP instead of spending so much time setting up your localhost. The biggest advantage of MAMP is you just need to install and use with least manual config.

To download MAMP click here. They provide free and pro version. The install process is straightforward.

Install and create your PHP web app with MAMP

After installing, open MAMP and click on  “Start Servers” to start your localhost.

When you see the two checkboxes Apache Server and MySQL Server are green, the “Start Server” button turns green and change to “Stop Server” you know that everything is set up and you’re good to go.

Next, click on Open Start Page, the middle button to open the starting page.

This page is where you can access your website, phpinfo page and something else.

Click on “My Website” to go to your page, by default MAMP is installed in your C drive and so your web root folder must be “C:/MAMP/htdocs”.It means when you type “localhost” in your browser it will show the index file in the htdocs folder. Now, I will create a new file “add.php” and copy the code of the add application I created in this post (source code is at the end of the post) into this new file.  My folder now looks like this:

To access this specific page, I type “localhost/add.php”

So now I can run my simple web application in my localhost so easily, thank to MAMP.



Please enter your comment!
Please enter your name here