PHP from the Command Line

Reading Time: < 1 minute

Recently I learned that PHP has a built in server. You don’t need xampp or any of the other solutions. All you need is terminal open, have the current directory be the one with the PHP files you want to serve and type: “php -S localhost:8000”

This might sound obvious to some but it took years for me to come across this. When you have to install xampp or other solutions you need to dedicate HD space, run the servers and more.

With just one line in terminal we can start the server and start experimenting with and learning PHP. With this you can be up and running within seconds or minutes, rather than hours, and it is flexible.

I’m sharing this with you now because I wish that at least once course had mentioned it. This is the simplest and most elegant solution I have found. Best of all it’s free.

For more info: https://www.php.net/manual/en/features.commandline.webserver.php