 |
Installing PHP on a Windows Server with IIS6
SUMMARY This article contains instructions for installing PHP on a Windows server with IIS6. These instructions will demonstrate installing PHP 5.0.4. These instructions can be followed to install any PHP 5.x build. These instructions assume that you do not have MySQL or PHP installed on the server. If you have either installed on your server please uninstall them before following these instructions. The following topics are discussed in this article: INSTRUCTIONS Downloading PHP Download PHP from PHP's download area - http://www.php.net/downloads.phpYou will need to download the Windows PHP 5.x ZIP package. Do NOT download the Windows Installer. It does not contain some key files that you will need.
[top] Installing PHP 5.x on IIS5 Search your server for libmysql.dll. Delete any instance of libmysql.dll, this limits the possibility of older MySQL client API's being used with PHP.
Search your server for php_mysql.dll. Delete any instance of php_mysql.dll, this limits the possibility of older MySQL client API's being used with PHP.
Unzip your php-5.x-Win32.zip file to C:\PHP this is where PHP will be installed at.
Create a C:\PHP\phpsessions directory. This is the directory that PHP sessions will be saved to.
Set the NTFS permissions on the C:\PHP folder and all child objects to allow the IUSR_COMPUTERNAME user FULL CONTROL. (Replace COMPUTERNAME with your servers computer name).
Create your php.ini file.
Open up the C:\PHP\php.ini-dist file in a text editor. (Notepad will work).
Search for the line that looks like this...
;extension=php_mysql.dll
Change this line to...
extension=php_mysql.dll
Search for the line that looks like this...
;session.save_path = "/tmp"
Change this line to...
session.save_path = "C:\PHP\phpsessions"
Search for the line that looks like this...
session.gc_maxlifetime = 1440
Change this line to...
session.gc_maxlifetime = 43200
Search for the line that looks like this...
SMTP = localhost
Change this line to reflect the hostname of your SMTP mail server...
SMTP = smtp.mycompany.com
Search for the line that looks like this...
;sendmail_from = me@example.com
Change this line to reflect the default email address you would like PHP to use...
sendmail_from = info@mycompany.com
Save the modified file as C:\%WIN%\php.ini
Copy C:\PHP\libmysql.dll and C:\PHP\ext\php_mysql.dll to the C:\%WIN%\system32 folder.
Open up the IIS manager by going to Control Panel > Administrative Tools > Internet Information Services (IIS) Manager
Add PHP as a Web Service Extension
In the left column right click Web Service Extensions and select Add a new web service extension.  On the New Web Service Extension window for Extension Name enter php and check the Set extension status to Allowed. Click Add.  On the Add File window enter the path to C:\PHP\php5isapi.dll. Click OK.  You should now have all of the Web Service Extension information filled in. Click OK. 
In the IIS Manager on the left column. Right Click Web Sites and go to Properties.  - Add PHP as an ISAPI Filter.
- Go to the ISAPI Filters tab. Click Add.
- For the Filter Name enter php and for the Executable enter C:\PHP\php5isapi.dll. Click OK.

Add an Application Extension Mapping for PHP
Add index.php as a Document Index file.
Go to the Documents Tab. Click Add. Enter index.php into the box. Click OK. 
Click OK on the Website Properties box.
A new box may popup asking if you want to apply the settings to certain websites. Here you can either choose specifically which websites you want PHP enabled on or Select All. Click OK.  Restart IIS
In the left column of the IIS manager right click your Computer Name and go to All Tasks > Restart IIS.  On the Stop/Start/Restart window choose Restart IIS from the dropdown menu and hit OK.  IIS will now restart.
You should have PHP completely installed now. Now it's time to test it out.
Open up Notepad and start a new document. Add the following text into your new document.
<?php phpinfo(); ?>
Save this new file to your website root as phpinfo.php.
Pull up your web browser and open up the phpinfo.php file in your web browser. You should have a output screen of all of PHP's info from your server.  If the page pulls up then PHP is working.
[top]
|
 |
 |
| Article ID: |
78 |
| Created: |
April 22, 2005 |
| Updated: |
January 24, 2006 |
| Rating: |
(4738 votes)
|
|