PHP built-in server

suggest change

Versions

The built-in server has been available since PHP 5.4. The original version list on this page ran through PHP 7.1.

Introduction

Learn how to use the built-in server to develop and test your application without other tools such as XAMPP or WAMP.

Parameters

Column Column
-S Start the built-in web server
<hostname>:<port> The host name and the port to use
-t Public directory
<filename> The routing script

Remarks

An example of router script is:

<?php
// router.php
if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) {
    return false;    // serve the requested resource as-is.
}  // the rest of your code goes here.
// A query string is part of REQUEST_URI, so image.png?x=1 does not match this pattern.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents