HomeDev BlogPHPSet up a localhost and make a web page using MAMP and..

Many users confuse with the URL of localhost setup in MAMP. The fact is that the URL depends on the ports you choose to use for your local server. Go to “Ports” tab when you are in the “Preferences” section. Click on “MAMP default” or “80 & 3306” button to setup the server / MySQL ports accordingly. Mar 21, 2018 localhost and 127.0.0.1 are port loopbacks on a single machine. To access from a different machine you will need to use the xampp machines ip address or computer name. Get your xampp machine name (ie. URL が localhost/MAMP に変わっていれば完了です。 スタートページの日本語化 Welcome to MAMP ページを日本語で表示したい場合は 【MAMP】バージョン 6.x を日本語化する方法 をお読み下さい。. After successful installation you can launch your local servers. Start MAMP and click on the Start Servers button. In the status display in the upper right corner, the launch status of the servers is displayed. The web server (Apache) starts by default on port.

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.

Xampp Localhost Url

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.

With XAMPP (Windows)

Localhost Url Mampilly

  • Locate your hosts file. In Windows XP, this file is located in C:WINDOWSsystem32driversetc. Different versions of Windows may store the file in a different directory. And depending on your Windows setup, you might need to be logged in as an administrator to modify the hosts file.
  • Open the file with a plain text editor (like Notepad++ or Sublime Text). In the hosts file, you should see something similar:

Right below the line 127.0.0.1 localhost, enter your domain name information. Example:

  • Put all your website files in a folder “mysite” (for example) and put it in C:xampphtdocs like this C:xampphtdocsmysite.
  • Go to C:xamppapacheconf
  • Open httpd.conf file using a plain text editor (like Notepad++ or Sublime Text) and if you have a “#” before Include conf/extra/httpd-vhosts.conf, remove it by changing:

to: Yt music.

i.e. uncomment the line so that it can includes the virtual hosts file.

  • Go to C:xamppapacheconfextra and open httpd-vhosts.conf file using a plain text editor (like Notepad++ or Sublime Text) and add the following code:
  • If not already open, open XAMPP control panel and start Apache.
  • Go to the URL: http://mysite.local/
  • You are done.
Localhost url mamp download

With WAMP (Windows)

Same steps as that of XAMPP just change the paths according to WAMP which corresponds to path in XAMPP.

  • Locate your hosts file. In Windows XP, this file is located in C:WINDOWSsystem32driversetc. Different versions of Windows may store the file in a different directory. And depending on your Windows setup, you might need to be logged in as an administrator to modify the hosts file.
  • Open the file with a plain text editor (like Notepad++ or Sublime Text). In the hosts file, you should see something similar:

Right below the line 127.0.0.1 localhost, enter your domain name information. Example:

  • Put all your website files in a folder “mysite” (for example) and put it inC:wampwww like this C:wampwwwmysite.
  • Go to C:wampbinapacheapacheX.X.XXconf
  • Open httpd.conf file using a plain text editor (like Notepad++ or Sublime Text) and if you have a “#” before Include conf/extra/httpd-vhosts.conf, remove it by changing:

to:

Url

Wonderswan emulator pc. i.e. uncomment the line so that it can includes the virtual hosts file.

  • Go to C:wampbinapacheapacheX.X.XXconfextra and open httpd-vhosts.conf file using a plain text editor (like Notepad++ or Sublime Text) and add the following code:
Localhost url xampp
  • Restart your server.
  • Go to the URL: http://mysite.local/
  • You are done.

With MAMP (Mac OS)

The easiest way to set up virtual hosts in MAMP is to use the commercial version of MAMP, which automates the process through the MAMP Pro console. However, if you don’t want to buy MAMP Pro, it’s quite simple to do it manually by editing two files. You need to be logged in as a Mac administrator to edit the files.

  • Locate your hosts file. This file is located in /etc/hosts. You might need to be logged in as an administrator to modify the hosts file.
  • Open your console in mac and edit your hosts file like this:
  • This opens a system file that contains the following line:
  • add your desired host name after local host:
  • Press ESC, then :wq! to overwrite and close the file.
  • Put all your website files in a folder “mysite” (for example) and put it in/Users/MyUsername/ like this /Users/MyUsername/mysite.
  • Go to /Applications/MAMP/conf/apache/
  • Open httpd.conf file using a plain text editor (like Notepad++ or Sublime Text) and if you have a “#” before Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf, remove it by changing:

to:

i.e. uncomment the line so that it can includes the virtual hosts file.

  • Go to /Applications/MAMP/conf/apache/extra/ and open httpd-vhosts.conf file using a plain text editor (like Notepad++ or Sublime Text) and add the following code:
Localhost url mamp list
  • Restart your server.
  • Note: If your URLs seem to be broken make sure to set AllowOverride to “All” in the Apache config file: /Applications/MAMP/conf/apache/httpd.conf (It’s around line number 206).
  • Go to the URL: http://mysite.local/
  • You are done.

References