Skip to content
| Marketplace
Sign in
Visual Studio>Tools>PHP Site Runner
PHP Site Runner

PHP Site Runner

Jetsonsoft

| (0) | Free
Open a folder of PHP files and press F5 to run it as a website with PHP's built-in server. Shift+F5 stops it. The server listens on localhost only, and the extension never needs administrator rights.
Download

PHP Site Runner

PHP Site Runner runs a folder of PHP files as a website from inside Visual Studio. Open the folder and press F5. The extension starts PHP's built-in web server and opens the site in your browser. Press Shift+F5 to stop it.

You don't need a project file or IIS, and the extension never asks for administrator rights.

A PHP blog open in Visual Studio. The PHP Server pane in the Output window lists the PHP command line and each request, and the status bar says the site is running at http://127.0.0.1:8000.

Requirements

  • Visual Studio 2022 (17.14 or later) or Visual Studio 2026. Community, Professional and Enterprise all work.
  • PHP for Windows. Get the x64 zip file from windows.php.net. The extension was tested with PHP 8.6.

Getting started

  1. Extract the PHP zip file to C:\PHP. That's where the extension looks by default. If PHP is somewhere else, set its folder under Tools > Options > PHP Site Runner.
  2. In Visual Studio, choose File > Open > Folder and pick your website's folder.
  3. Press F5.

The PHP Server pane in the Output window shows which folder F5 will serve. While the site runs, the pane also shows each request.

Running a site

You can start a site in three ways:

  • F5 or Ctrl+F5 runs the site in the open folder.
  • Right-click a folder or file in Solution Explorer and choose Run as PHP Site. If you right-click a .php file, the browser opens that page. Once the site is running, the same item changes to Open PHP Site in Browser, and Stop PHP Site appears below it.
  • Tools > PHP Site > Run Folder as PHP Site... lets you pick any folder on disk.

The Solution Explorer context menu for index.php while the site runs, with Open PHP Site in Browser, Stop PHP Site and Set as PHP Start Page near the bottom.

Each folder runs in its own PHP process. The first site gets port 8000 and each additional site gets the next free port.

Keyboard

Key What it does in a PHP folder
F5 or Ctrl+F5 Starts the site and opens it in the browser. If the site is already running, it opens the browser again.
Shift+F5 Stops all running PHP sites.
Ctrl+Shift+F5 Restarts the site.

In a solution, F5 runs the PHP site only if the solution has no startup project. A solution with a C# or C++ startup project builds and debugs as usual. While a debugger is attached, the keys keep their normal meaning.

To turn the keys off, set Use F5 and Shift+F5 for PHP sites to False in the options.

Which folder F5 serves

F5 serves the open folder if it has .php files at its top level. Otherwise it looks for the first of public, www, htdocs, web or public_html that does. This covers most frameworks that keep their entry point in public.

Start page

By default F5 opens the site root (/). To open a different page, right-click a .php or .html file and choose Set as PHP Start Page. The command is on the Solution Explorer menu, the editor menu and the document tab menu.

A check mark next to the command shows the current start page. Choose it again to go back to the site root. Visual Studio remembers the start page for each folder separately.

Options

Find these under Tools > Options > PHP Site Runner > General.

Option Default Notes
PHP folder or php.exe C:\PHP The folder that holds php.exe, or the full path to it.
php.ini file (blank) Leave blank to use the php.ini next to php.exe.
Show errors in the page True Shows PHP errors and warnings in the browser. When False, errors go to the Output window only.
Port 8000 The first port to try.
Router script (blank) A PHP file inside the site that handles every request, for frameworks with a front controller. For example, index.php.
Startup timeout (seconds) 10 How long to wait for PHP to start before giving up.
Open browser after start True When False, the URL is written to the Output window instead.
Use F5 and Shift+F5 for PHP sites True See Keyboard.
Stop sites when the solution closes True When False, sites keep running until you stop them or close Visual Studio.

Security

The server listens on 127.0.0.1 only. Other computers on your network can't reach it, and Windows Firewall has nothing to ask you about. There's no option to change this.

The extension installs for your user account and never starts anything elevated. If php.exe is set to run as administrator, you get an error explaining why instead of a UAC prompt.

It refuses to serve a drive root, the Windows folder, Program Files or your user profile folder. A router script has to be a .php file inside the site.

PHP processes belong to Visual Studio. When Visual Studio closes or crashes, Windows ends them too.

The extension doesn't collect telemetry. Diagnostics are written to your own disk and go nowhere else.

PHP's built-in server is meant for development. Don't use it to host a public website.

Diagnostics

Choose Tools > PHP Site > Show PHP Site Diagnostics to see a report for each running site in the Output window:

  • PHP version, process ID, uptime and startup time
  • Memory and CPU use
  • Request counts by status (2xx, 3xx, 4xx, 5xx)
  • Connection timing (average and slowest)
  • PHP errors by type, plus the most recent one
  • The most requested missing pages (404s)

The same report is saved as JSON to %LOCALAPPDATA%\PhpSiteRunner\diagnostics.json, so you can attach it to a bug report. Starts, stops and unexpected exits are also written to the Visual Studio activity log.

Troubleshooting

"php.exe was not found." Check PHP folder or php.exe in the options. It should point to the folder you extracted PHP into.

F5 builds my C# project instead. The solution has a startup project, so F5 keeps its normal meaning. Right-click the website folder and choose Run as PHP Site.

F5 doesn't start anything. The open folder needs .php files at its top level or in one of the folders listed under Which folder F5 serves. The PHP Server pane says which folder it found when the folder opens.

"php.exe asks for administrator rights." Your php.exe has "Run as administrator" set in its compatibility settings, or it's a repackaged build. Use the standard zip file from windows.php.net.

My framework's routes return 404. Set Router script to the framework's front controller, usually index.php in the public folder.

Release notes

1.2

  • F5, Ctrl+F5, Shift+F5 and Ctrl+Shift+F5 run, stop and restart the PHP site.
  • Set as PHP Start Page picks the page F5 opens.
  • The site folder is found automatically, including public, www, htdocs, web and public_html.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft