Jocke,
There are a few points here. First is your comment about "it just complains about it not returning valid headers (or something)." This sounds like you may have been returning an emtpy page, which most browsers (most notably Netscape from my experience) don't like. For example, let's say you wrote a PHP file called TEST.PHP and you accessed it via http://youraddress/TEST.PHP, and the file contained
<?
if (0) {
echo "Oh no!";
}
?>
Since the IF condition evaluates to false, the echo command is never executed, meaning the result of the code is nothing at all. THIS will not go well with most browsers. So my first comment would be to make sure that all your webpages with PHP code generate some output, ANY output. Even if it's just a few space characters.
Second, you ask about installing the CGI version of PHP on NT/IIS. It really doesn't matter whether you have NT Workstation or NT Server (technically, they're the same EXACT OS, just with several hundred registry tweaks and the appropriate license from M$). In both cases you likely are using the Microsoft Management Console (MMC) to manage IIS, correct? It's the easiest way to go.
Anyway, the only real major change from configuring IIS to use ISAPI to configuring IIS to use the PHP.EXE is how you do the AppMapping. That is,
NOTE: I'll assume the following in the instructions:
Windows NT is installed in C:\WINNT
Your IIS webroot is at C:\INETPUB\WWWROOT
You have decompressed the PHP files to C:\PHP
You will use the extension .PHP for your PHP files [Others use extensions like .PHTML, .CGI, .PHP4, etc.]
Adjust accordingly.
- Download the PHP .zip file from www.php.net or www.zend.com.
____________________________________________________________
- Decompress the contents of the .zip file to the directory C:\PHP.
____________________________________________________________
- Move the MSCVRT.DLL and PHP4TS.DLL files in C:\PHP to C:\WINNT\SYSTEM32.
____________________________________________________________
- Copy C:\PHP\PHP.INI-DIST to C:\PHP\PHP.INI, then move C:\PHP\PHP.INI to C:\WINNT\PHP.INI.
____________________________________________________________
- Modify C:\WINNT\PHP.INI so that the information contained in it reflects your environment. This will require reading through the PHP.INI file and learning what the various parameters mean, but for starters find and modify the following:
doc_root = "C:\INETPUB\WWWROOT"
extension_dir = "C:\PHP"
Later, as you become more familiar with PHP, be sure to go back to C:\WINNT\PHP.INI and look at sections such as
...
[mail function]
...
[Sessions]
...
and modify them accordingly so that you can start using some of the cooler features in PHP.
- Run the MMC.
____________________________________________________________
- Right-click on the webserver you wish to have PHP support added to.
____________________________________________________________
- Select Properties from the popup menu.
____________________________________________________________
- In the dialog box that appears (which has 2 rows of tabs), click on the "ISAPI Filters" tab and make sure you do NOT have a filter in place that uses the php4isapi.dll file. If there are any, delete them.
____________________________________________________________
- Click on the "Home Directory" tab, then click on the [Configuration...] button.
____________________________________________________________
- Click on the "App Mappings" tab and see whether you have a mapping for the extension ".php".
____________________________________________________________
- If the mapping already exists, click on that mapping to select it and click the [Edit] button. If the mapping does NOT yet exist, click the [Add...] button.
____________________________________________________________
- In the dialog box that comes up, be sure that it reads
+-------------------------------------------------
| Add/Edit Application Extension Mapping
+-------------------------------------------------
| Executable: C:\PHP\php.exe %s %s
| Extension: .php
| Method Exclusions:
| [x] Script engine
| [x] Check that file exists [OK] [Cancel] [Help]
+-------------------------------------------------
- Click [OK] 3 times to save the changes you have just made. You can now exit the MMC.
____________________________________________________________
- Though not absolutely necessary, if possible, reboot NT or shutdown/restart the w3svc (using "net stop iisadmin" and "net start w3svc" from a Command Prompt).
At this point, your box should be configured for PHP. To test, create a file called C:\INETPUB\WWWROOT\TEST.PHP which reads
<?
phpinfo();
?>
and then view it in your browser by entering
http://site/test.php
where "site" is either the IP address of the NT box, it's DNS name, or the word "localhost" if you are using a browser on the same box.
This should generate a page full of information on the installed version of PHP.
Don't know if that was total overkill, but hope it is of some help. If not, let me know. I have PHP v4.0.2 running in CGI form on my box, and so far it's working rather well.