Programster's Blog

Tutorials focusing on Linux, programming, and open-source

PHP - Use the Integrated Webserver for Quick Debugging


Ever since PHP 5.4, PHP has a built-in webserver to help with debugging. This can be useful if you just want to test a script quickly on your local computer without having to configure Apache or nginx.

To run the integrated webserver, simply navigate to the directory you want to act as your website's root and execute:

php -S localhost

If you already have apache2 running, then you may want to use a different port as shown below:

php -S localhost:8080
Last updated: 16th September 2021
First published: 16th August 2018