Run PHP Scripts without Apache on Windows

1Shares

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.

Hi, my name is Anto! I am a cloud computing hobbyist! Give me anything to do with the cloud, and I am interested. I work for a Cloud computing company by day and as a Cloud computing hobbyist by night! My projects use PHP, NodeJs, Ubuntu, MySQL and of course Amazon Web Services. Hopefully, my blog aids your cloud journey! Feel free to post a comment and share your thoughts.

Leave a Reply

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

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