Quick & Dirty PHP Devel Setup on Windows

Here’s a quick tip if you’re developing a really simple PHP site and need a development setup on Windows with minimal fuss. Don’t bother with a full LAMP stack like XAMPP, which requires you to run a batch file that will rewrite its Apache and PHP configuration files.

PHP version 5.4.0 and above comes with a handy built-in webserver. Simply download the binaries for Windows and unzip it into a directory of your choice. Start the server with the following command and you’re good to go!

php -S localhost:8000 -t <directory>

This will start a web server that listens on port 8000 on localhost with the specified directory as your document root. If you need more control, you can also specify a “router” PHP script that will handle each HTTP request.

When you no longer need to use the “development environment”, just delete the directory which you unzipped PHP into.

Simple.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.