Test Hosting with the PHP Built-in Web Server
The PHP command line (CLI SAPI) has a built-in Web server that is useful for quick Grav site testing or demos. It is not a full-featured Web server and should not be used on a public network.
Using the CLI Web Server
- On the command line, navigate to the [GRAV_ROOT] folder.
- Run
php -S localhost:8080 system/router.phpto start the server. You need PHP 8.3 or newer (check withphp -v). You should see a response like the one below.
[Fri Dec 4 07:50:03 2026] PHP 8.4.28 Development Server (http://localhost:8080) started
- Browse to the URL specified, e.g.,
http://localhost:8080/. - To stop the Web server, press Ctrl-C.
Address Already in Use Error
If you get an "Address already in use" error when executing the php -S command, there is already a Web server running on your machine at the specified port number (e.g., :8080). You can resolve this by changing the port number in your command (e.g., :8181) and trying again.
Real-Time Log Display
The CLI Web server displays its log in real-time as you browse the site, which can be helpful for quick testing.
[Fri Dec 4 07:50:03 2026] PHP 8.4.28 Development Server (http://localhost:8080) started
[Fri Dec 4 07:50:04 2026] [::1]:57165 Accepted
[Fri Dec 4 07:50:04 2026] [::1]:57165 [200]: /
[Fri Dec 4 07:50:04 2026] [::1]:57165 Closing
[Fri Dec 4 07:50:04 2026] [::1]:57170 Accepted
[Fri Dec 4 07:50:04 2026] [::1]:57170 [200]: /assets/fd2c5827e1f18bb54d20265f4fc56b59.css
[Fri Dec 4 07:50:04 2026] [::1]:57170 Closing
Tip
Always start the server with system/router.php. The router is what sends page URLs to Grav and refuses direct requests for private files such as user/config/system.yaml; without it, PHP serves every file in the folder as-is.
The bin/grav server command wraps this same setup, and uses the Symfony CLI instead when it is installed.
Learn More
Visit the PHP Web site to learn more about the CLI Web server.