PHPs built-in server

A crafty little tool - PHP and the easy-to-use built-in server

📅 08 Mar 2021

Did you know that PHP comes with a built-in server?

This was great news for me!

I previously wrote about how I was using PHP to provide some additional functionality on my site. But, at the time, I didn’t know about PHPs built-in server. This means that whenever I wanted to preview some changes, I had to run my script before opening the html files.

I know. You are smarter than me and either already figured this out or knew another way. But, I’m not as smart as you.

In case you didn’t know about this and wanted to give it a try, getting the server up and running is very easy.

First, your project needs to either have an index.html or index.php.

Next, all you have to do is cd into your project directory and enter the following in the terminal:

php -S localhost:8000

And you are good to go!

And yes, in case you are still reading, we are now on PHP 8.0.3, so yeah, this has been around for a while. But, I’m late to the game and am learning as I go.


Day 40: #100DaysToOffload

💬 Looking for comments?

I don't have comments on this site because I don't feel like managing them.

Instead of leaving a comment, feel free to ✉️ contact me instead.