Hi,

Since upgrading to PHP 4.02 many or all of my IE 4 SP2 clients cannot access any PHP page. IE reports that it received "an invalid or unrecognisable response". Only PHP files do this all others .htm .html work fine. IE 5.0 clients work fine. But I have about 5 IE 4.0 clients on 95 and NT that don't work. Upgrading to IE 5 fixes the problem

I'm using IIS 4 on NT 4 SP6a with ISAPI enabled. Any ideas?

    Avoid ISAPI? :-)

    Seriously, just a short note here, which may or may not be of use. I know there are still issues with the ISAPI version of PHP v4.0.2 with regards to session management. It's conceivable that there are other issues as well. I only use the CGI version at this point, until such time that the ISAPI module works properly.

    On another note, I noticed that the MSCVRT.DLL file in v4.0.2 is newer than what's typically found in \WINNT\SYSTEM32, whereas in the past it was the same file basically so I never replaced it. With v4.0.2, I replaced the MSVCRT.DLL in NT with the one that came with PHP v4.0.2. Don't know if it will matter, but thought I'd mention it.

    [NOTE: Trying to drag the file into \WINNT\SYSTEM32 will only get you an error saying the file is in use. I used the Command Prompt to rename NT's MSVCRT.DLL to MSVCRT.DLL.OLD, then copied the PHP version into the directory and rebooted.]

      Hi,

      I've got huge problems with the ISAPI filter and wanted to run the CGI executable. But I can't get it to work, it just complains about it not returning valid headers (or something).

      So, I'm wondering, how do I install the CGI version of PHP on IIS4 on NTwks. I've heard about something alled php4ts.exe, seen the DLL, but that won't work.

      Happy for any help!

      /Jocke

        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.

        1. Download the PHP .zip file from www.php.net or www.zend.com.
          ____________________________________________________________
        2. Decompress the contents of the .zip file to the directory C:\PHP.
          ____________________________________________________________
        3. Move the MSCVRT.DLL and PHP4TS.DLL files in C:\PHP to C:\WINNT\SYSTEM32.
          ____________________________________________________________
        4. Copy C:\PHP\PHP.INI-DIST to C:\PHP\PHP.INI, then move C:\PHP\PHP.INI to C:\WINNT\PHP.INI.
          ____________________________________________________________
        5. 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.


        1. Run the MMC.
          ____________________________________________________________
        2. Right-click on the webserver you wish to have PHP support added to.
          ____________________________________________________________
        3. Select Properties from the popup menu.
          ____________________________________________________________
        4. 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.
          ____________________________________________________________
        5. Click on the "Home Directory" tab, then click on the [Configuration...] button.
          ____________________________________________________________
        6. Click on the "App Mappings" tab and see whether you have a mapping for the extension ".php".
          ____________________________________________________________
        7. 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.
          ____________________________________________________________
        8. 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]
        +-------------------------------------------------


        1. Click [OK] 3 times to save the changes you have just made. You can now exit the MMC.
          ____________________________________________________________
        2. 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.

          Frank,

          Thank you very much! This was the longest ever answer that I have seen, and the most coprehensive! In fact, this should be included in the manual (or the FAQ)!!

          Thanks again, I hope many others too will have use from your post!

          /Jocke

            a year later

            Awesome! Thanks for taking the time out to document this. Big help!!!!!!

              Write a Reply...