Set up your computer
If you already run PHP 8.1 or newer, skip this page and go to the Quick start. This page is for anyone who hasn't set up PHP before. It gives one setup and the reasons for it. There are other good setups; picking one of them is a job for later.
What you're installing, and why
| Tool | What it does for you |
|---|---|
| XAMPP | PHP, the Apache web server, a MySQL-compatible database (MariaDB) and phpMyAdmin, from one installer. |
| VS Code | The editor. Free, and it understands PHP once you add one extension. |
| Git | Records every change you make, so a mistake is one command from undone. On Windows it also gives you Git Bash, a terminal where the commands in these docs work as written. |
Why XAMPP rather than PHP on its own? The built-in server Core uses (php -S) is the simplest way to run it, but installing PHP alone on Windows means downloading a zip, editing your PATH and switching on extensions in php.ini by hand. Most people give up at that point. XAMPP is one installer, and it includes the same php command.
The second reason matters more. Apache with .htaccess, MySQL and phpMyAdmin is close to what a typical shared hosting plan runs. Problems you'd otherwise meet on a client's live site show up on your own machine, where they cost nothing.
What it costs: XAMPP is slow to pick up new PHP versions, and it isn't built to be secure. It is for your computer only. Never open it to the internet, and don't treat its PHP version as the one to ask your host for.
Windows, step by step
1. Install XAMPP
Download it from apachefriends.org and run the installer. Two choices matter:
- Install to
C:\xampp, the default. Not Program Files: Windows locks that folder down, and XAMPP fails to save files there. - Components: Apache, MySQL, PHP and phpMyAdmin are all you need. Untick the rest.
Open the XAMPP Control Panel and press Start next to Apache. If the label turns green, it works. Visit http://localhost to check.
2. Put PHP on your PATH
This is the step everyone skips, and it's why php bin/install.php later fails with "'php' is not recognized".
- Press the Windows key, type environment variables, and open Edit the system environment variables.
- Press Environment Variables. Under your user's variables, select Path and press Edit.
- Press New, type
C:\xampp\php, and press OK on each window. - Close every terminal you have open, open a new one, and type:
php -v
You should see a version number of 8.1 or higher. If you see a different version than you expected, an older PHP is earlier in your PATH; move C:\xampp\php above it.
3. Install Git
Download Git for Windows from git-scm.com and accept the defaults. Afterwards you can right-click inside any folder and choose Open Git Bash here.
Check your PATH change worked here too: php -v in Git Bash should print the same version.
4. Install VS Code
Download it from code.visualstudio.com. Then open the Extensions panel (the four squares on the left) and install PHP Intelephense. It underlines mistakes as you type and shows you what a function expects when you hover over it.
To look inside your database while you build, install DB Browser for SQLite (sqlitebrowser.org). Open storage/database/app.sqlite with it and you can see every table and row.
5. Run Core
- Download Core and unzip it into
C:\xampp\htdocs\. You get a folder calledvanillasaas-core, orvanillasaas-core-mainif you used GitHub's Download ZIP. - Rename that folder after the app you're building, for example
dog-walker. It's your project from now on, and the name follows it into Git, VS Code and your host. Nothing in Core depends on it. - Make sure Apache is running in the XAMPP Control Panel.
- Open http://localhost/dog-walker/ and create an account.
- In VS Code, choose File → Open Folder and open
dog-walker.
That's a working app. The database was created on your first visit.
Start your next app the same way, from a fresh download in a folder of its own. Don't copy one app's folder to make another: the copy brings the first app's database and users with it. Each app gets its own sign-in cookie, so you can be signed in to both at once.
6. Start a Git history
In Git Bash, inside the project folder:
git init
git add .
git commit -m "Core as downloaded"
Commit again each time something works. When something breaks, git diff shows exactly what you changed since.
Mac
Skip XAMPP. Install Homebrew from brew.sh, then:
brew install php
php -v
Run Core with PHP's built-in server, as in the Quick start. Git comes with the Xcode command-line tools: type git --version and macOS offers to install them. VS Code and DB Browser for SQLite are the same as on Windows.
For MySQL and phpMyAdmin, install MAMP. You only need it for the last step on this page.
Linux
On Ubuntu or Debian:
sudo apt install php-cli php-sqlite3 php-mysql git
php -v
Then use PHP's built-in server as in the Quick start.
Build on SQLite, check on MySQL
Stay on SQLite while you build. There's no database server to start, no install step, and when you add a table the migration is applied by the next request that uses the database.
Most shared hosts give you MySQL, though, and the two don't behave identically. So once, before you go live, run your app on MySQL on your own computer:
Create the database. In the XAMPP Control Panel, start MySQL. Open http://localhost/phpmyadmin, choose New, and create a database called your_database (or any name you like).
Point Core at it. Create app/config.local.php:
<?php
return [
'db' => ['driver' => 'mysql', 'mysql' => ['name' => 'your_database']],
];
XAMPP's MySQL user is root with no password, which is what Core expects by default, so the database name is the only setting to change. Use a real password on the live server; see Configuration.
Create the tables. Run php bin/install.php from the project folder. Or, in phpMyAdmin, import database/schema.mysql.sql and then each file in database/migrations/mysql/, in name order: that's the route you'll use on a host with no command line, so it's worth a rehearsal.
Click through everything. Sign up, sign in, every form, every list.
Anything that breaks here would have broken in front of your client. Delete config.local.php, or set the driver back to sqlite, to return to building.
When something goes wrong
Apache won't start. Another program is using port 80. On Windows it's usually IIS, or an old copy of Skype. Close the other program, or in the XAMPP Control Panel press Config next to Apache, open httpd.conf, change Listen 80 to Listen 8080, and visit http://localhost:8080/dog-walker/ instead.
"'php' is not recognized". Step 2 didn't take. Check the Path entry is exactly C:\xampp\php, then open a new terminal; old ones keep the old PATH.
The page shows PHP code instead of running it. You opened the file directly (the address starts file://). Use the http://localhost/... address.
A blank page or an error about writing a file. The storage/ folder isn't writable. That's rare on Windows and common on Mac and Linux: make storage/ and everything in it writable by your user.
Password reset emails never arrive. They aren't sent while you build. Open storage/logs/mail.log and copy the link from the bottom of the file.
Tools left out on purpose
Docker, Laragon and Laravel Herd are all good. Each is one more thing to learn before you write any code, and none of them is needed to build, test and launch a Core app. Come back to them once you've shipped something.
Next: Quick start.