Downloading and Installing XAMPP on Mac

Before downloading XAMPP, make sure that you either stop your current running instance of MySQL, or uninstall it (if any). XAMPP comes with its own MySQL distribution.

1. Installing XAMPP

Download XAMPP for MAC OS from and follow the installation instructions on that page. Type in the URL http://localhost in your favorite browser to see the start page of XAMPP. If all is well, you should see the XAMPP home screen.

If Apache doesn't start, or if MySQL appears to be deactivated under the Status link, open the XAMPP Control application that is in the XAMPP folder (on my computer, it is named Make sure that Apache and MySQL servers are running.

Alternately, you can start the MySQL server from the command line using

   sudo /Applications/XAMPP/xamppfiles/xampp startmysql

To stop XAMPP, use

   sudo /Applications/XAMPP/xamppfiles/xampp stop

To start XAMPP, use

   sudo /Applications/XAMPP/xamppfiles/xampp start

For more options, see the documentation available on the download page, or invoke


2. Testing XAMPP

You can test whether XAMPP runs properly by following the steps below:

  1. Start XAMPP (unless already running)
  2. Use a text editor ro create a file named myPHPtest.php (note that the file extension must be ".php" (instead of ".htm").
  3. Insert the following code in the file:

       <?php echo "Hello World! This is my PHP test!"; ?>

  4. Save the file in the folder Applications/XAMPP/htdocs.
  5. Open the file in your browser with the address


If the browser writes Hello World! This is my PHP test! the installation was successful, and you're ready to use PHP on your computer. Otherwise, see the XAMPP website for more information, or use the forums for support.

Remember to always save your files and folders in htdocs (full path should be Applications/XAMPP/htdocs/).

You will also need to launch the file via a url (e.g.: http://localhost/myphpfile.php) in the browser address bar, not by double-clicking an icon or via the File Open menu option. In each of the two latter cases, the .php file is not being processed by the web server and thus not being routed to PHP for parsing/execution.