
this is a common issue and easy to fix! This guide will walk you through the step-by-step solution to get your PHP files running in the browser.
🔍 Why This Error Happens
The error means that Live Server (Five Server) can’t find the PHP executable (php.exe
on Windows) to run .php
files. This is because:
- PHP is not installed.
- The path to PHP is not set in VS Code settings.
- Your system doesn’t know where to find
php
.
✅ How to Fix It (Step-by-Step)
✅ Step 1: Install PHP (If Not Already Installed)
🔸 For Windows:
Install XAMPP from the official website:
👉 https://www.apachefriends.org/download.html
After installation, the PHP executable will usually be at:
C:\xampp\php\php.exe
🔸 For Ubuntu:
Open terminal and run:
sudo apt update
sudo apt install php
🔸 For macOS:
Use Homebrew:
brew install php
✅ Step 2: Get the Path to Your PHP Executable
Depending on your OS:
OS | Command or Path |
---|---|
Windows | C:\xampp\php\php.exe |
Ubuntu | Run which php in terminal |
macOS | Run which php in terminal |
✅ Step 3: Configure PHP Path in VS Code
- Open VS Code.
- Press
Ctrl + Shift + P
(orCmd + Shift + P
on macOS) to open the command palette. - Type and select:
“Preferences: Open Settings (UI)”

- In the search bar, type:
Five Server > PHP: Executable
- You’ll see an option:
“Absolute path to PHP executable. string” - Paste your PHP path here:
- For Windows (XAMPP):
C:\xampp\php\php.exe

- For Ubuntu/macOS:
Output ofwhich php
(e.g.,/usr/bin/php
)
Click Apply to All Profiles (if needed) and Save.
Now Run Your PHP File
- Open any
.php
file. - Click “Go Live” at the bottom of VS Code.
- Your browser should now render the PHP output successfully! 🎉