If you want to set up your Windows computer to test PHP pages, you will need to set up IIS first. When I had Windows XP, I had to buy the Professional version of the operating system to get IIS. IIS is included in Windows 7 Home Premium. You can find instructions for setting up IIS here: Setting Up IIS 7.0 by Microsoft TechNet. When you get done, you should have an inetpub
directory in your hard drive’s root directory, and there should be a wwwroot
directory within that (C:\inetpub\wwwroot
). The wwwroot
directory is where you will put your HTML pages, your PHP pages, and anything else you want to test locally on your Web Server.
At this point, you can test to make sure that standard HTML pages are working properly. You will need to know your computer’s name for the URL to your local pages (or localhost
). Go to the computer’s Control Panel. (In Windows 10, type control panel
in the search box to find it.) Click on “System and Security”. Click on “System”. Your computer’s name should be listed on that page. If you have an HTML test file named test.htm
in your wwwroot directory, your URL for your browser should be: http://COMPUTERNAME/test.htm
<html> <body> <h1>Hello, world!</h1> <p>This is a test of HTML.</p> </body> </html>
You can find the binaries on the PHP For Windows: Binaries and sources Releases page. If you know the version of PHP that your Internet Service Provider (ISP) is using, it might be a good idea to install the version to match theirs. The ISP for a site I set up for a friend recently upgraded their PHP installation, and there were some changes that had to be made to make the site run properly on the new version. I’ll discuss some of the changes I needed to make in a future post. Having matching versions can help prevent problems, at least until your ISP decides to upgrade.
You can find the instructions at the PHP: Installation on Windows systems – Manual page. The two Windows Installer links will tell you how to install the binaries according to the version you have decided to use. The installation process should set up the options in IIS that are needed for PHP to run. If PHP does not run after installation, the Microsoft IIS links on the PHP: Installation on Windows systems – Manual page should help you get going.
Once you have PHP installed, you can test it. You can use a simple file such as phpinfo.php
in your wwwroot
directory containing the following:
<html> <body> <?php phpinfo(); ?> </body> </html>