PHP XAMPP Runner
The all-in-one PHP + XAMPP toolkit for VS Code: open files in the browser with one click, live-preview with auto-reload, start/stop Apache and MySQL, link any folder into htdocs without copying, create virtual hosts (myapp.test), check syntax as you save, set up Xdebug, edit php.ini safely, use Composer and Laravel Artisan, back up MySQL — and a Doctor that tells you what is wrong with your setup.
TirotirPHP is our companion extension (same author, Daryoush Alipour): ready-to-insert PHP examples from the basics to forms, cookies, sessions, file handling and database operations. Use it to write the code, and PHP XAMPP Runner to run it. Install it from the Extensions view (search TirotirPHP) or run PHP XAMPP: TirotirPHP — PHP Examples by the Same Author.
Features
- Open in Browser (
Ctrl+Alt+B) from the editor, title bar, Explorer, right-click menu or the CodeLens at the top of every PHP file. Works for .php, .phtml, .html.
- Auto-detects XAMPP (C:\xampp, D:\xampp, Program Files,
/opt/lampp, /Applications/XAMPP) — no more hard-coded paths. Override with phpXampp.xamppPath.
- Smart URLs: files with spaces or Persian/Unicode names are encoded correctly; a custom Apache port is read from
httpd.conf; folders outside htdocs can use PHP's built-in server or your own URL mappings (virtual hosts).
- Live Preview beside your code, reloads when you save PHP/HTML/CSS/JS, with Mobile / Tablet / Desktop widths.
- Apache & MySQL control from a status-bar indicator (
Apache ● MySQL ○), a menu and a sidebar view. Start, stop, restart, and see logs if something fails. On macOS/Linux the commands run sudo lampp … in a terminal.
- Change Apache port with one command when port 80 is busy (IIS, Skype…).
httpd.conf is backed up first.
- Syntax check on save (
php -l) with errors in the Problems panel.
- Run PHP file (CLI) in the terminal panel.
- Xdebug setup: configures
php.ini (with a backup), creates a "Listen for Xdebug" launch configuration and offers to install PHP Debug.
- php.ini tools: enable/disable extensions (gd, intl, zip, mysqli…) with checkboxes, edit memory limit, upload size, timezone, error display. Backups are created automatically.
- XAMPP sidebar (Explorer): server status, quick links (localhost, phpMyAdmin, htdocs), config & logs, and all projects in
htdocs with one-click open.
- New project templates: basic site, PHP + MySQL notes app (PDO, CSRF, prepared statements), JSON REST API starter. Optionally creates the database and imports
setup.sql.
- MySQL helpers: create a database, import any
.sql file (right-click → Import SQL File into MySQL).
- Live log watching for Apache, MySQL and PHP error logs.
- Link a folder into htdocs — no copying: Link This Folder into htdocs creates a junction/symlink, so your project can live anywhere (Desktop, D:\Projects…) and still run at
http://localhost/<name>/.
- Virtual hosts: Create Virtual Host writes
httpd-vhosts.conf, enables it, adds the name to your hosts file and maps it for Open in Browser (http://myshop.test). Everything is backed up and can be removed again.
- Doctor: one report with XAMPP, PHP, Apache/MySQL ports, who is using port 80, missing PHP extensions, timezone, Xdebug, Composer and file permissions.
- Run Selection of PHP code (or the whole file) and see the output instantly — a quick scratchpad.
- Composer (install, update, require, dump-autoload…) and Laravel Artisan (serve, migrate, make:model/controller/migration, tinker…) from the Command Palette.
- MySQL backup (
mysqldump) of any database to a .sql file.
- Open folders in the browser from the Explorer right-click menu.
- Choose your browser: default, Chrome, Firefox, Edge, Brave, Opera or a custom executable.
Requirements
XAMPP (or any PHP install for the built-in server mode) and VS Code 1.75+.
Quick start
- Put your project in
htdocs (or use PHP XAMPP: New PHP Project in htdocs…).
- Open a
.php file and press Ctrl+Alt+B. On Windows Apache is started automatically if needed.
- Click
Apache ● MySQL ○ in the status bar for the full menu.
Settings
| Setting |
Default |
Description |
phpXampp.xamppPath |
auto |
XAMPP folder |
phpXampp.phpPath |
auto |
PHP executable |
phpXampp.serverMode |
auto |
auto, apache, builtin |
phpXampp.urlMappings |
[] |
[{ "folder": "D:/sites/shop", "url": "http://shop.test" }] |
phpXampp.apachePort |
0 |
0 = read from httpd.conf |
phpXampp.mysqlRootPassword |
empty |
For stop/create/import |
phpXampp.browser |
default |
Browser to use |
phpXampp.startApacheOnOpen |
true |
Windows: auto-start Apache |
phpXampp.previewAutoReload |
true |
Reload preview on save |
phpXampp.lintOnSave |
true |
Syntax check |
phpXampp.codeLens |
true |
Links above PHP files |
phpXampp.composerPath |
empty |
Composer executable (default: from PATH) |
Use PHP XAMPP: … in the Command Palette for every action.
Notes
- Editing
php.ini/httpd.conf inside C:\Program Files may need VS Code to run as administrator.
mysqlRootPassword is stored in your user settings; XAMPP's default is an empty password.
License
MIT
| |