Thursday, 2 July 2015

PHP Built-in Web Server

As of PHP version 5.4.0 to later versions, PHP is bundled with a built-in web server by default.
This blog will show you how to get started. It is pretty much easy to set up and helpful, especially in a situation where you want to quickly test your web application without necessarily hosting it online or you don't want to install XAMP or WAMP.

Below are the procedures

  1. First thing first, Make sure you download PHP following this link:, install it.
  2. Go to your command prompt or terminal in case you are on Mac or Linux, change directory to your working directory by using the cd command.
  3. Type: php -v to check your version of PHP and also make sure PHP is installed properly. If PHP is installed properly, you will see your PHP version. In that case you can continue to the rest of the steps, else go back and make sure your PHP is installed properly.
  4. Still on your command prompt or terminal, you then choose the IP address and port you want your application to be running on. Just type php -S name, for example, and press Enter. If all is well, you will see your PHP version, the IP address and port your server is listening on and your document root as show below.
  5. create any php file in your working directory... Navigate to and you will see your output.