Install Local Server Environment

HTML, CSS and JavaScript files can all be opened in a browser or previewed in Phoenix Code Editor.  But for PHP and MySQL – you need some extra software to turn your computer into a virutal environment.

For Mac:  Herd + Homebrew MySQL
  1. Go to herd.laravel.com, download the DMG, and drag Herd into Applications.
  2. Open Herd from Applications — this triggers onboarding, which installs PHP, nginx, and dnsmasq.
  3. Check it worked by typing php --version and composer --version in Terminal.
  4. Install Homebrew if you don’t already have it:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  1. Install and start MySQL through Homebrew:

brew install mysql

brew services start mysql

  1. Check it worked:

mysql --version

  1. Secure the fresh install (sets a root password, removes test databases):

mysql_secure_installation

Herd serves project folders from its Sites location, or you can run herd link inside any project folder to serve it at projectname.test — worth typing that command out yourself so it’s clear it isn’t automatic.

For Windows: XAMPP
  1. Go to apachefriends.org/download.html and download the Windows installer.
  2. Run it. If your antivirus flags it, that’s a known false-positive with the installer — allow it.
  3. Open the XAMPP Control Panel and click Start next to both Apache and MySQL.
  4. Test it: open a browser to http://localhost — you should see the XAMPP welcome page.
  5. Manage databases at http://localhost/phpmyadmin.

Project folders for PHP/MySQL apps must live inside XAMPP’s web root to be served by Apache:

C:\xampp\htdocs\your-project-folder