Page 1 of 1

PHP on IIS. Getting includes to parse PHP...

Posted: Wed Sep 04, 2002 11:35 pm
by network23
I don't have particulars right now, but I wanted to ask this question ASAP in hopes of getting an answer sooner than later. I can post particulars (IIS/NT/PHP versions, etc. tomorrow if needed). I know PHP is at least 4.x...

Is there any way to get IIS to execute .php files if they are added via an SSI include statement? Our setup is not doing this.

Here's the quick history. I took over a large intranet running on Netscape Enterprise on NT. No perl, no PHP, nothing but some kludgy javascript. I spent a lot of time at it but finally got PHP running under this system. Not wanting to rename and relink every page to .php extensions, I had (what I thought at the time) a brilliant idea. Using SSI, I could include PHP files even if the html file containing the SSI include was an .htm. I gave the includes .php extensions and IT WORKED! Oh joy! Rapture!

A month later, I find that IT hates NS Enterprise (says it crashes too often) and is switching over to IIS. It's my responsiblity to get PHP running, which I do (just yesterday). I see that php(info) works, but all my SSI-included .php's do not!

Is there any way to get this working? Is there something I missed? Is there any other alternative I can try that would allow me the .php's to run inside .htm's (and I don't think the IT staff would allow IIS to parse every file for php)?

Posted: Thu Sep 05, 2002 12:30 am
by Takuma
How about configure the server so it parses .html as a PHP file

Posted: Thu Sep 05, 2002 9:11 am
by network23
IT staff is worried about the performance hit if IIS has to parse every .htm file.

Posted: Thu Sep 05, 2002 9:12 am
by m3mn0n
I don't think it would affect the performance that much.

Posted: Thu Sep 05, 2002 9:35 am
by network23
Here are the specs I promised... see if these might affect your opinion on a performance hit if IIS parses all .htm's

PHP 4.2.1
Server API: ISAPI
NT 4
IIS/4.0

Anything else I should list that might sway opinions on affecting performance?

Posted: Thu Sep 05, 2002 9:43 am
by volka
IIS is capable of SSI but by default it is enabled for .shtml and .shtm only.
If you add .htm it should work, too ;)

Posted: Thu Sep 05, 2002 11:38 am
by network23
IIS is capable of SSI but by default it is enabled for .shtml and .shtm only.
If you add .htm it should work, too
SSI's are running (we've already done your tip), but unlike under Netscape's server, .php's aren't processed in IIS's SSI's, the raw php code is just sent out to the rendered page, viewable in the source. Netscape would process all included php's before rendering the page, allowing for nested php's inside SSI includes.

Posted: Thu Sep 05, 2002 11:43 am
by volka
even when using <!--#exec cgi="path/to/php.exe file.php"--> ?

Posted: Thu Sep 05, 2002 2:33 pm
by network23
I've never used exec before. I'll give it a try but first two questions...

Under NT, would the "path/to/php.exe" be the drive path (ie, starting with the drive letter)?

Following that path, is it possible/necessary to put the path/to/file.php or does the .php file need to go in a directory that's automatically searched by php for php files?

Posted: Thu Sep 05, 2002 7:25 pm
by volka

Posted: Mon Sep 16, 2002 4:56 pm
by network23
volka,

exec worked! Thanks for the suggestion!

I just replaced the "include virtual=" part with "exec cgi=" to the path of the php file and it ran as intended.