Here's a list of step-by-step instructions of how I do it:
The next step is to configure PHP for Apache. This is done by adding two new lines to Apache's configuration. The first line loads the PHP module, and the second one defines which filetypes that should be parsed by PHP. How the first line should look depends on which versions of Apache and PHP that you've chosen.
- Download and install Apache.
- Download your preferred version of PHP (the ZIP file, not the installer).
- Unpack the contents of the ZIP file to your preferred location.
- Open Apache's configuration file (located in c:\path\to\apache\conf\httpd.conf).
LoadModule php4_module "c:\path\to\php\sapi\php4apache.dll"
LoadModule php4_module "c:\path\to\php\sapi\php4apache2.dll"
LoadModule php5_module "c:\path\to\php\php5apache.dll"
The second line that should be added is this:
LoadModule php5_module "c:\path\to\php\php5apache2.dll"
This tells Apache that files with the extensions php and foo should be parsed by PHP.
AddType application/x-httpd-php .php .foo
Now we're almost done. There is just one thing left; the configuration of PHP. There are two configuration files that you can choose from; php.ini-recommended and php.ini-dist (both are located in the PHP folder). Choose the one you want (I think that the options set in php.ini-dist corresponds most to the settings used by most hosts (correct me if I'm wrong)), copy it to c:\Windows, and rename it to php.ini.
After you've changed the options in the configuration file to fit your needs, you'll have to restart Apache for the changes to take effect (Start menu -> Programs -> Apache HTTP Server -> Control Apache Server -> Restart). After you've done that, save this little script in c:\path\to\apache\htdocs (or whatever Apache's DocumentRoot directive is set to) with the extension php (e.g. hello-world.php).
When that's done, start up your web browser, and type in http://localhost/hello-world.php (change the filename to whatever you named your script) in the address bar. If everything is working properly, the text "Hello World" should be displayed on the page.
<?php echo 'Hello World'; ?>