Run your PHP code using the PHP webserver

You can run PHP scripts on Windows without needing to install WAMP or Apache webserver. This is great if you don't need all the features that these tools provide. The PHP built-in web server is not intended for production use but is great for developing and testing.

Lets get started!

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 your terminal interface.

Step 2 - Run the built-in PHP web server using:

php -S localhost:8080 -t c:\path-to-my-code\

The -S argument specifies the server name and port you wish to use. Additionally, the -t argument specifies the path to your PHP code. You can, of course, change the value of these arguments to suit your needs.

Finally, you should now be able to browse your PHP script via your browser. The PHP built-in webserver will ensure your PHP script is running on an available port.

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

Frequently asked questions

What is WAMP?

WAMP stands for Window, 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.

LAMP vs. WAMP

WAMP stands for Window, Apache, MySQL, and PHP. And WAMP is a variation on LAMP, which stands for Linux, Apache, MySQL, and PHP. So essentially, you would run LAMP on Linux-based platforms and WAMP on Windows-based platforms.

Is WAMP Free?

WAMP is free under the GPML license and is available for 32 and 64-bit versions.

What is XAMPP?

XAMPP stands for cross-platform, Apache, MySQL, PHP, and Perl. Consequently, it means that XAMPP is supported by platforms like Mac OS, Linux, and Windows. Conversely, Windows supports WAMP, and Linux supports LAMP. Just like WAMP and LAMP, XAMPP is a compilation of free software.

What is the PHP built-in webserver?

This is a web server that is designed to aid application development and testing. Therefore you do not need to install NGINX or Apache since the built-in webserver provides a single-threaded process.

Can you use the PHP built-in web server in production?

No. This web server is designed to aid application development and testing. It is not intended to be a full-featured web server as it only supports a single-threaded process. Additionally, it would be best if you did not use it on a public network.

You may also be interested in



About the Authors

Anto's editorial team loves the cloud as much as you! 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! Contact Anto Online if you want to contribute.

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 “Run your PHP code using the PHP webserver”

Leave a Reply

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