How to run PHP code on Windows (No Apache!)

You can run PHP scripts on Windows without needing to install an entire WAMP stack.

What is WAMP?

WAMP stands for Window, Apache, MySQL and PHP. WAMP is a variation on LAMP, which stands for Linux, Apache, MySQL and PHP.

A Complete WAMP stack provides many features that could be useful for a developer. These features include: FastCGI, OpenSSL, phpMyAdmin, ModSecurity, ImageMagick, xDebug, Xcache, ModSecurity, Memcache and much more.

Not everyone needs a full WAMP stack. Fortunately PHP ships with it’s own built in web server.

How to run PHP script without WAMP

You will need to download and install PHP to use the built-in PHP web server. Click here to visit the PHP download site.

Step 1 – Open Windows Command Prompt

Press “Windows” and “r” keys simultaneously and type “cmd”:

Step 2 – Navigate to your PHP install folder

Using Windows Command Prompt navigate to your PHP install folder. This PHP install is on the W: drive in a folder called “PHP”:

Step 3 – Run the built-in PHP web server

Run the built-in PHP web server using:

php -S localhost:8080 -t W:\PHPCode\

The -S argument specifies the server name and port you wish to use. The -t argument specifies the path to your PHP code. Change the value of these arguments to suit your needs.

You should now be able to browse your PHP script, via your browser.

Simply navigate to http://localhost:8080 as per your -S PHP argument.

About the Authors

Each member of Anto's editorial team is a Cloud expert in their own right. Anto Online takes great pride in helping fellow Cloud enthusiasts. Let us know if you have an excellent idea for the next topic!

Support the Cause

Support Anto Online and buy us a coffee. Anything is possible with coffee and code.

Buy me a coffee

One Comment on “How to run PHP code on Windows (No Apache!)”

Leave a Reply

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