Use the built-in PHP server in WordPress development

Unlike the traditional development setup which requires to download and config a web server, you can use the built-in PHP server, which doesn’t ask for any complicated configuration like Apache HTTP Server or nginx …

Create a directory where you want to run PHP code,

$ mkdir php-project

$ cd php-project

then start a locally-awesome server,

$ php -S localhost:8000

That’s it, you have a fully-functional PHP web server, good enough for development.

For WordPress, just download the package and extract, access the extracted directory, and start the server.

$ wget -O

$ unzip

$ cd wordpress

$ php -S localhost:8000

You can change the localhost to any of binding network interface on your machine and replace 8000 for any port you want to set for development.

That means, when you want to develop multiple WordPress projects at the same time via one local address, you can spawn each project with different ports. It might be like this,

$ cd project-01

$ php -S localhost:9001 &

$ cd ../project-02

$ php -S localhost:9002 &

$ cd ../project-03

$ php -S localhost:9003 &

Well, I personally think this is much more convenient than manual configuring web server for newly-added projects. It’s also good for newbies to avoid the configuration hell when dealing with whatever XAMPP, LAMP, MAMP, WAMP …

Not only for WordPress, but also for every code running in PHP. Not to mention that many modern PHP frameworks make uses of this today, like Laravel, Lumen, Symfony, CakePHP, CodeIgniter… just to name a few.

Enjoy coding PHP 🙂

Share This :

Leave a Reply

Your email address will not be published. Required fields are marked *