This article shows how to install PHP 5.2.14 on Server 2003. The installation allows MSJC students to create their own websites using PHP and use FTP to update their files. By doing so, students will have a hands on experience and will be prepared for the real life challenges and accomplishments when building a website with PHP. In a future article I will show how to install MySQL on the same server and how to configure it to work with PHP.
After a fresh installation of Server 2003 we need to download the latest PHP version.
Go to http://www.php.net/
and select downloads. PHP version 5.3 was released, but as of today Microsoft does not support ASAPI extension for version 5.3. As such, let’s download the previous version, 5.2.14.
Scroll down to Windows Binaries and choose “PHP5.2.14 zip package”. Download it in a folder.
Create a folder C:\PHP5, open the downloaded zip file, and copy all the archived files into the new folder. Make sure to preserve the directory structure.
PHP5 comes with a file called “php.ini-recommended”. Find it in the C:\PHP5 directory and rename it to “php.ini”. This is the configuration file we will update for our installation.
Open “php.ini” and find the property extension_dir = “./”. Change it to point to the PHP extension folder as follows:
extension_dir = “C:\PHP5\EXT
Also, look for “cgi.force_redirect” redirect property and turn it off by changing 1 to 0. Save the file and close it.
Next, you need to add the PHP5 directory to the Path, in the Environment Variables. Right click on My Computer and open Properties. Hit the Advanced tab and click the Environment Variables button. In the System Variables find Path and click Edit. Add to the path the new folder, C:\PHP5. Windows Server 2003 will need a restart for the new Path to take effect.
Open IIS manager and right click on Web Sites. Choose Properties. Go to Home Directory tab and hit the Configuration button. Click on Add button, browse to PHP5 directory and choose “php5asapi.dll”. Select it and then go to extension and type “.php”. Hit OK to close that window. Check in Application extensions that .php was added as in the following figure.
Hit OK again to return to the Web Site Properties.
Go to Documents tab and click on the Add button to add the default content page. Type in “index.php” and hit OK.
Back in the Documents tab move “index.php” to the top, so that this will be the default page for the website.
Click OK to close the Web Site Properties window.
Right click on the website configured for PHP, e.g. msjc-php-class, and select Home Directory. Make sure “Scripts only” is selected at Execute permissions. Do not use "Scripts and Executables", as this will only increase the chances that the server will be hacked with exec files.
Hit OK to close this Properties window.
Right click on the Web Service Extensions and select “Add a new Web service extension”. Type PHP and click on Browse. Navigate to the PHP5 folder and select “php5isapi.dll”. Hit OK.
In the New Web Service Extension window the file “php5isapi.dll” should appear under required files. Check Set extension status to Allowed and click OK. Now PHP should appear under Web Service Extension and should be Allowed.
Now PHP should be installed. To test it, create a file “index.php” with the code
and save it in the website default directory. When the website is run, a PHP information page appears which shows that the installation was successful.
Copyright ©2010 Dr. Adrian S. Nastase