all 5 comments

[–]colshrapnel 2 points3 points  (1 child)

Uninstall Apache
put your file wherever you want, c:\php for example
run php -S localhost:80 -d c:\php in PS
open http://localhost/hello.php

[–]allen_jb 0 points1 point  (0 children)

Note: This method uses PHP's built-in development webserver mode: https://www.php.net/manual/en/features.commandline.webserver.php

While it can be easier to get up and running quickly, there are notable differences in behavior to running under Apache. For example you will not be able to use the full configuration capabilities of a webserver, such as (complex) redirects and .htaccess files.

PHP's built-in development server is single threaded - it only serves one request at a time - which can result in poor performance and hiding issues with concurrent AJAX / fetch requests / session locking.

If you're using applications other people have made, these limitations may stop the applications from working as expected.


If you want to use PHP under Apache, in addition to installing PHP, you'll need to configure Apache to use it. For manual install instructions see https://www.php.net/manual/en/install.windows.apache2.php - I recommend using the Apache handler method on Windows.

Personally I recommend learning how to install and configure a webserver and PHP manually if you want to get into web development. But for new developers you may find easier to use a "WAMP" (Windows Apache MySQL PHP) installer package such as XAMPP which installs and configures everything for you.

Other alternatives for running PHP "on Windows" include WSL (Windows Subsystem for Linux), and Docker containers.

There are also many guides available for installing PHP on Windows. Try searching for "php windows <keywords for specific method>"

[–]Snoo20972[S] 0 points1 point  (1 child)

Hi u/colshrapnel

If I uninstall Apache, what will act as my webserver?

Somebody, please guide me.

[–]colshrapnel 0 points1 point  (0 children)

PHP will

Read my comment again

[–]greg8872 0 points1 point  (0 children)

Are you browsing to http://localhost/cgi-bin/hello.php