In PHP version 5.4 built in web server was introduced. This cool feature enables serving of PHP, HTML and other files without having a web server installed. It is simple and straightforward to use, just type
php -S localhost:8000
8000 here is a port number, you can choose any port that is available on your system. After running this command, you will be able to access this server only from your local machine, it won’t be accessible over network.
The intended usage of this feature is for demonstration and development. It’s not intended to be used in production. Most of the people use it only on their own machines, that is on machines which they use of development and this is probably why most books and tutorials only mention the above given command.
However, there might be a need to be able to access this server from other computers on the network and it is possible to do that as well. You just need to replace ‘localhost’ with the IP address of your network interface, or use ‘0.0.0.0’ to listen on all available networks. So, the command is:
php -S 0.0.0.0:8000
For more information see the manual.