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
- First thing first, Make sure you download PHP following this link: http://php.net/downloads.php, install it.
- 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.
- 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.
- 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 127.0.0.1:port name, for example, 127.0.0.1:1337 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.
- create any php file in your working directory... Navigate to 127.0.0.1:1337/index.php and you will see your output.