PHP Built in server
suggest changeVersions
[{“Name”:“5.4”,“GroupName”:“PHP 5.x”},{“Name”:“5.5”,“GroupName”:“PHP 5.x”},{“Name”:“5.6”,“GroupName”:“PHP 5.x”},{“Name”:“7.0”,“GroupName”:“PHP 7.x”},{“Name”:“7.1”,“GroupName”:“PHP 7.x”}]
Introduction
Learn how to use the built in server to develop and test your application without the need of other tools like xamp, wamp, etc.
Parameters
Column | Column | —— | —— | -S | Tell the php that we want a webserver | <hostname>:<port> | The host name and the por to be used | -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 you code goes here.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents