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