SSI for Apache 2

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
Sergeant Thorne
DBB Material Defender
DBB Material Defender
Posts: 4641
Joined: Sun Nov 25, 2001 3:01 am
Location: Indiana, U.S.A.

SSI for Apache 2

Post 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!
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 16138
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Post by Krom »

Anything showing up in error.log?

I assume you already read: http://httpd.apache.org/docs-2.0/howto/ssi.html
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

if you are using PHP, there is no need for SSI.
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 16138
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Post by Krom »

Good point ;)
User avatar
Sergeant Thorne
DBB Material Defender
DBB Material Defender
Posts: 4641
Joined: Sun Nov 25, 2001 3:01 am
Location: Indiana, U.S.A.

Post 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.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post 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.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post 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?
User avatar
Sergeant Thorne
DBB Material Defender
DBB Material Defender
Posts: 4641
Joined: Sun Nov 25, 2001 3:01 am
Location: Indiana, U.S.A.

Post 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
User avatar
Sergeant Thorne
DBB Material Defender
DBB Material Defender
Posts: 4641
Joined: Sun Nov 25, 2001 3:01 am
Location: Indiana, U.S.A.

Post 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!
User avatar
Sergeant Thorne
DBB Material Defender
DBB Material Defender
Posts: 4641
Joined: Sun Nov 25, 2001 3:01 am
Location: Indiana, U.S.A.

Post 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. ;)
User avatar
Sergeant Thorne
DBB Material Defender
DBB Material Defender
Posts: 4641
Joined: Sun Nov 25, 2001 3:01 am
Location: Indiana, U.S.A.

Post 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?
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

blame IIS?
Post Reply