DEV Community

muncey
muncey

Posted on

Run a local PHP web server

One of the reasons that I like using PHP is that it is an easy language to pickup and also an easy language to create a new project. I will often times use PHP as a prototyping language and once I am happy with the project move onto a more robust platform such as .NET or Java.

To create a new web server using PHP is actually very easy. All that you need to do is create a file such as index.php with some php and html code in it and then run this command:

php -S localhost:3000

This command will start a local web server that you can then access easily enough at http://localhost:3000 as per the example below.

image

Top comments (0)