Page 1 of 1

SSI for Apache 2

Posted: Fri Jun 04, 2004 6:27 am
by Sergeant Thorne
I wonder if someone could help me out here, please: I haven't been able to get SSI to work at all on my Apache 2 server. The server is running on Windows 2000 Pro.
Here are the pertinent lines from the configuration file:

Code: Select all

LoadModule include_module modules/mod_include.so
...
Options FollowSymLinks +Includes
...
AddType text/html .shtml 
AddOutputFilter INCLUDES .shtml
I want to be able to use SSI with my php pages also (possibly every hyper-text document type), so I added the bold line to the end of the configuration file, after the lines for the PHP module:
# Load PHP4 as a module
LoadModule php4_module "c:\Server Files\php\sapi\php4apache2.dll"
AddType application/x-httpd-php .php
AddOutputFilter INCLUDES .php
Thanks for taking the time to read!

Posted: Fri Jun 04, 2004 10:48 am
by Krom
Anything showing up in error.log?

I assume you already read: http://httpd.apache.org/docs-2.0/howto/ssi.html

Posted: Fri Jun 04, 2004 11:28 am
by fliptw
if you are using PHP, there is no need for SSI.

Posted: Fri Jun 04, 2004 11:48 am
by Krom
Good point ;)

Posted: Fri Jun 04, 2004 1:17 pm
by Sergeant Thorne
On the contrary, I can use SSI to import a widely used custom PHP function into several pages from a single easily changeable source. SSI can be a lot more convenient, also.

You assume correctly, Krom, and I believe I've followed all of their directions.

The log (nothing):
[Fri Jun 04 14:04:31 2004] [notice] Parent: Created child process 912
[Fri Jun 04 14:04:31 2004] [notice] Child 912: Child process is running
[Fri Jun 04 14:04:31 2004] [notice] Child 912: Acquired the start mutex.
[Fri Jun 04 14:04:32 2004] [notice] Child 912: Starting 250 worker threads.

Posted: Fri Jun 04, 2004 1:33 pm
by fliptw
you can do in PHP via use of the require function.

if you want to use PHP and SSI together, you need to set the AddType and OutputFilter directives for SSI, not PHP.

like:

AddType text/html .shtml .php
AddOutputFilter INCLUDES .shtml .php

if that does work, then it might be easier just to use PHP by itself.

Posted: Fri Jun 04, 2004 1:50 pm
by DCrazy
Yeah there is no sense in running every page through mod_include just to have it go through the PHP parser. Use either require() or include(), depending on whether you need the page to exist or not.

And in any event wouldn't you need to use "AddType application/x-httpd-php .shtml" instead of "AddType text/html .shtml" anyway?

Posted: Fri Jun 04, 2004 1:57 pm
by Sergeant Thorne
I stand corrected. ;) Now that you mention it, I guess I've seen those functions (require(), and include()) before, it just never clicked. Those seem every bit as convenient (and probably better for performance).
fliptw wrote:AddType text/html .shtml .php
AddOutputFilter INCLUDES .shtml .php
I had actually tried that.

Thanks a lot, guys! :D

Posted: Fri Jun 04, 2004 2:01 pm
by Sergeant Thorne
DCrazy wrote:Yeah there is no sense in running every page through mod_include just to have it go through the PHP parser. Use either require() or include(), depending on whether you need the page to exist or not.
Right
DCrazy wrote:And in any event wouldn't you need to use "AddType application/x-httpd-php .shtml" instead of "AddType text/html .shtml" anyway?
I intend to use PHP instead of SSI, now, but I'm going to have to give that a try anyway, just out of curiosity.

Thanks!

Posted: Fri Jun 04, 2004 2:13 pm
by Sergeant Thorne
Not unless I'd want .shtml files to go through the PHP processor, DCrazy.

I guess I'd still like to get SSI working: even though I'll be using PHP in it's place, I would still like to have the functionality available. Also, if it's going to be disabled, I want it to be disabled because I disabled it, not because I couldn't get it working. ;)

Posted: Wed Aug 25, 2004 3:35 pm
by Sergeant Thorne
Well, I just had an experience that makes me wonder if maybe SSI just plain isn't meant to work with PHP. I'm working on a website (not hosted by me) that is running on Windows 2003. The service supports both ASP and PHP, but when I converted an ASP page over to PHP just now, the SSI directive contained in it quit working.

Has anyone else experienced this?

Posted: Wed Aug 25, 2004 3:40 pm
by fliptw
blame IIS?