I am currently setting up a Xitami Web Server for my windows 98 machine. I have got perl 5 working fine but am having trouble-getting php to work.

I have added the following lines to the c:\xitami\defaults.cfg file:

[Filter]
.php=c:\php\php.exe
.php4=c:\php\php.exe
.phtml=c:\php\php.exe
.php3=c:\php\php.exe

[Mime]
Php=application/x-httpd-php4
Php4=application/x-httpd-php4
Phtml=application/x-httpd-php4
Php3=application/x-httpd-php3

I edited the c:\windows\php.ini file and made extension_dir=C:\PHP\EXTENSIONS because that is where all the php dll files are located.

I wrote a quick test script c:\xitami\cgi-bin\phptest.php

#! c:\php\php
<?php
echo “php is working”;
?>

when I type http://localhost/cgi-bin/phptest.php I get a blank web page appear.

Any help would be greatly appreciated.

Regards,
Anthony Irwin

    I can get Xitami working with PHP with only adding the lines under filter. You might try getting rid of "#! c:\php\php" because windows doesn't require this normally.

      13 days later

      The reason why Xitami will not work with PHP4 is that the script location to PHP4 is given by the environment variable PATH_TRANSLATED. But on Xitami the PATH_TRANSLATED is just put together by the document root and script name. It doesn't look up any aliases defined in Xitami.

      Due to this incosistency between Xitami and PHP4 the script will not be run. There is a bug in the PATH_TRANSLATED in Xitami. But it will probably take long time before its fixed. I have tried numerous way to configure PHP to get the file to parse on some other way, without luck. The only fix I came up with so far is to use a batch-file to call PHP, however this means a great security risk along with longer execution time, so I don't recommend it.

      PHP3 just reads the file specified as an argument on the command
      line.

      That's why PHP3 will work but not PHP4.

        Hi

        I have PHP4 working fine with Xitami on my Win98 machine. I use this to test that php scripts are working before uploading to my ISP. But I certainly did have problems trying to use Xitami aliases, which is what David is referring to.

        Solution 1 is to change the main HTML directory in the setup configuration dialog, and keep your pages/scripts in that folder structure. This does cause some of Xitami's own help pages to fail, but I'm not too bothered about that.

        Solution 2 (better in my case) was to move my webpages and scripts into folders in the Xitami "webpages" directory, which is the installed default. The main HTML directory in the config dialog is then just the original value of "./webpages".

        I've only ever used php4, so I just have the one filter (.php=d:/php/php.exe).

        I was actually very surprised at how easy xitami and php4 were to get going together.

        Hope this helps, although I realise that everyone has slightly different requirements.

          Another thought, Anthony -

          re http://localhost/cgi-bin/phptest.php

          'localhost' will be mapped to the directory "xitami/webpages", unless you've changed the default for this. So doesnt that mean that it wouldnt find your script in "xitami/cgi-bin" any way?

            2 months later

            Yeah !

            Try to copy your php files to the webpages directory and they should work there don't
            ask me why.. at least for me it worked and i had the same problem as you did

              a year later

              When I went through the documentation I found that filters are automatically passed the normal CGI headers so there is no need for a /cgi-bin/ type url for php scripts unless that is something you would like.

              Brent is right, put the information in the filters area and leave the Mime info alone. For that matter, I like to have my perl scripts executable anywhere as well and have configured the .pl extension as a filter as well. That way I can disable CGI

              [Cgi]
              Enabled = "0"
              Form-query = "1"
              Monitor = "100"
              etc, etc. (this line not literal)

              and not worry the server with looking for a cgi related url. Performance has improved as a result.

              I am interested if anyone has looked into hooking up PHP with the LRWP WSX or FastCGI?

                Write a Reply...