Using Xampp On Mac

  1. This demonstrates how to run a php file on Apple Mac OS X using the default settings on XAMPP.
  2. After download XAMPP mac os version, double click it to install it. After install, you can start it by click XAMPP icon in finder /Applications folder. After click XAMPP icon, it will display below popup window. Click Start button to start both apache, mysql and ftp server as service.
  3. A little late to the thread but I hit and solved this issue and I believe the OP had downloaded and installed the wrong version. At the time I am writing this, the link on the downloads page is for.dmg file is a VM file, or at least missing features of the full download. Instead of downloading that, go to the more downloads section. Once there, choose the version you need for your OS.

Until I recently switched to XAMPP I had been using MAMP to provide a local server environment on my Mac. A small but none the less important feature of MAMP is an option to have the Apache and MySQL servers started when you open the application.

Xampp For Mac Os

One of the more advanced topics of setting up you local development environment on your Mac, especially when using third-party software like Xampp, is to set up Virtual Hosts.

Virtual Hosts allow you to create your own url (within the browser) and point it to your local directory on your hard drive. This means, instead of pointing to http://localhost , you can create a custom url such as myprojecturl.local .

Step 1: Editing our /etc/hosts file

The first thing we’ll need to do is to set up our /etc/hosts file. This is a hidden file that we’ll use to edit our custom url and point it to our local machine.

First we’ll have to open up Terminal (Use Spotlight search and search for Terminal and open it). Then inside Terminal we’ll type in:

You’ll be asked to type in your password. Just type in your log in password to your computer.
Then you should see something like this:

Scroll down by pressing the down arrow key all the way to the bottom and add this to a new line:

Note: Feel free to edit the name of the url. Brenton studio radley task chair assembly instructions. I like to add .local to the end of my custom urls so that I know I’m viewing my local files.

Using xampp on mac

It should now look like this:

Then press control + x and then type y to save your changes. Then press Enter to write out your changes.

Step 2: Editing Xampp’s httpd.conf file


Now we’ll need go into our XAMPP folder and edit a few things. Open up /Applications/XAMPP/xamppfiles/etc/httpd.conf file in any text editor (I use Sublime Text 2).

Somewhere around line 487, you should see something like this:

Just remove the # from the Include line like so:

Save the file and close it.

Step 3: Editing Xampp’s httpd-vhosts.conf file

Now that we have included the httpd-vhosts.conf file from the previous step, we’ll go in and edit that file to include our new project url.

Open up /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf file in your text editor.

You should see something like this:

You’ll notice that Xampp has provided a structure for a test example Virtual Host. We’ll create our own similar version.

On a new line add this to the end of the file:

You’ll notice that for the Servername I included the name of the url we had typed inside of our /etc/hosts file from Step 1.

The DocumentRoot and Directory values point to a folder directory where I have my local files set up at. Don’t forget to change the path to point to your folder directory.

Step 4: Testing your local site

Now you just have to restart your Apache server in Xampp’s Application Manager and test out your new url in a web browser. Just type in myprojecturl.local (or whatever you named it) into your browser url bar and you should see your site up and running.


Now you know how to set up Virtual Hosts for Xampp. Don’t forget, every time you edit the /etc/hosts file, the httpd.conf file, or the httpd-vhosts.conf file, you need to restart your Apache server for Xampp.

If you have any questions, feel free to comment below.

XAMPP is a free distribution package that makes it easy to install Apache Web Server, PHP, PEAR, and MySQL. Before installing XAMPP, you should turn off any other web servers and instances of MySQL you have running on your Mac.

XAMPP is a free distribution package that makes it easy to install Apache Web Server, PHP, PEAR, and MySQL. Before installing XAMPP, you should turn off any other web servers and instances of MySQL you have running on your Mac.

How to use xampp on mac

Installing XAMPP on a Mac

  1. Download XAMPP for Mac OSX - Be sure to select the proper version of PHP. For Webucator classes, any version after 5 will be fine.
  2. Open the downloaded file (the DMG-Image).
  3. Drag and drop the XAMPP folder into your Applications folder.

Starting XAMPP on OSX

To start XAMPP simply open XAMPP Control (by going to /Applications/XAMPP/ in Finder) and start Apache and MySQL on the Manage Servers tab.

If MySQL Does Not Start

If your MySQL server isn't starting, you may need to set the permissions for it using Terminal with this command:

Testing your OSX XAMPP Installation

In your web browser, go to http://localhost. You should see the start page of XAMPP:

Class File Permissions

  1. Cmd+click on the ApplicationsXAMPPxamppfileshtdocs folder and select 'Get Info'.
  2. If the lock symbol at the bottom indicates that this information is locked, click the lock icon to unlock, and enter your user credentials.
  3. Once the settings are unlocked, choose 'everyone' under 'Sharing & Permissions' and change the option to 'Read & Write'.

Class Files

  1. Download the class files.
  2. After downloading the class files, navigate to ApplicationsXAMPPxamppfileshtdocs and create a new folder named Webucator and extract your class files in that folder.

Setting the MySQL Password on Macs

  1. The PHP files use 'pwdpwd' for the MySQL root password, while the default password is NO password.
  2. Change the password to pwdpwd by opening Terminal (Applications > Utilities > Terminal) and enter:

You will be asked to enter your Mac password; enter it and press enter. Then you will be asked if you want to set a password for your XAMPP pages, then for MySQL, and then for MySQL/phpMyAdmin all of these just type 'n' for no and press enter.

Then it will say:

  1. Enter 'y' for 'yes, let me set a password for the root user' and press Enter
  2. Enter the password pwdpwd. You will be asked to enter it again for confirmation.
  3. Quit Terminal (Cmd+Q) and restart Apache and MySQL using the XAMPP Control Panel.

Testing phpMyAdmin

  1. Go to http://localhost
  2. Click on phpMyAdmin under Tools
  3. Enter 'root' for username
  4. Enter 'pwdpwd' for password

You should be able to get in.

Installing Northwind Database using XAMPP

NOTE: you should download the class files below before following these instructions, as it contains the Northwinds Database file(s).

  1. To install the Northwind database used in class, click on the 'phpMyAdmin' link on the left navigation bar of the XAMPP home page. That should take you to http://localhost/phpmyadmin.
  2. If it asks you to login, the username is root and the password is blank (unless you have already changed it to something else, like pwdpwd).
  3. On that page, click on the Import link under the Localhost heading.
  4. Browse to the Northwind-MySQL.sql file in your class files.
  5. Click the Go button on the bottom right of the page.
  6. You should get a Success message and Northwind should be added to the Database dropdown menu on the upper left of the page.

Recommended Editor

  • Visual Studio Code ( Download, Install, and Set up)
    • While you may use a different editor or IDE, Visual Studio Code is an excellent IDE to learn to code on. It provides a nice balance of power and simplicity and it is available on Windows and Mac.

Designate your testing server in Dreamweaver

NOTE: The following only applies if you are using Dreamweaver. If you are not, please ignore this section.

  1. Go to Site > New Site.
  2. In the Site Setup dialog, fill in the Site Name (e.g., PHP) and browse to the Local Site Folder (e.g., ApplicationsXAMPPxamppfileshtdocs).
  3. Choose the Servers tab.
  4. At the bottom of the box on the right, click +.
  5. On the Basic tab, provide a Server Name, set Connect using to Local/Network, ensure the Server Folder matches the local site folder you specified in step 2, and set the Web URL to http://localhost/Webucator/ClassFiles/.
  6. Click the Advanced button.
  7. In the Server Model field, select PHP MySQL.
  8. Click Save. The server should appear in the table on the Servers tab.
  9. Make sure that both the Remote and Testing checkboxes are checked.
  10. Click Save.

Testing PHP Files

All your class files should be located in ApplicationsXAMPPxamppfileshtdocsWebucatorClassFiles

2 Methods for Testing Files in Browser

To test any of the class files in your browser, say ApplicationsXAMPPxamppfileshtdocsWebucatorClassFilesPHPBasicsDemosHelloWorld.php, you can use 1 of 2 methods:

Method 1:

  • Go to http://localhost/Webucator/ClassFiles/PHPBasics/Demos/HelloWorld.php in your web browser.
  • Follow the same pattern to view all other class files; basically the ApplicationsXAMPPxamppfileshtdocs gets changed to http://localhost/

Method 2:

  • Go to http://localhost/Webucator/ClassFiles/ in your web browser.
  • Bookmark that page in your browser for easy access to it from now on.
  • From there, you can see all the lesson folders and drill down to any class file for testing/viewing

And that's it

How To Run Xampp On Mac

Happy Mac XAMPPing!