Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shtml with Apache on Mac OSX 10.4.4

Status
Not open for further replies.

Shrp

IS-IT--Management
Jan 9, 2002
82
US
I have Apache running on my PowerBook running Mac OSX 10.4.4 (not server).

I want to enable shtml files, but the include lines are not interpreted, and they don't result in an error. A "view source" just spits out the html and the include line.

I have the following lines uncommented in my httpd.conf:

/private/etc/httpd% grep shtml httpd.conf
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddType text/html .shtml
AddHandler server-parsed .shtml

I have the following line in my shtml file in attempt to include the html code in a file called 'h.txt':
<!--#include virtual="h2.txt" -->

The shtml and h.txt files are both world-read/execute.

If I upload these same shtml files to my website, they work just fine.

Thanks!
 
How do the httpd.conf files compare between your remote web site and your local machine?

Also note that there is an Apache forum here.

 
...and are you running the default Apache that came with OSX or your own install? The answer will not help me much but it might give you ideas.
 
It's the default Apache that came with OSX. I don't have access to the httpd.conf on my ISP's server, although I do have ssh access, I may not have privilege to see it, nor do I know where it is. I'd be happy to look.

I also posted this information with the original question on the Apache forum. Thanks!
 
Sounds like you haven't enabled server side includes in the apache config file, I don't think the default Mac config file enables them.
 
The only mention of server side includes in the httpd.conf is the portion I uncommented, and listed above. Is there another config file or section you're talking about that I need to modify? Thanks!
 
Okay, I haven't run shtml on my Mac in a while, (I switched to php) but I restored an old copy of my website and verified that the includes are still being parsed.

Here's a context diff of my httpd.conf and the default.

REMEMBER - just because you changed the file, doesn't change the web server! You need to stop and start apache. You can do this by turning websharing on and off from the system preferences.

*** httpd.conf Sat Jan 28 18:58:05 2006
--- httpd.conf.default Sun Mar 20 18:08:49 2005
***************
*** 235,241 ****
#LoadModule unique_id_module libexec/httpd/mod_unique_id.so
LoadModule setenvif_module libexec/httpd/mod_setenvif.so
#LoadModule dav_module libexec/httpd/libdav.so
! LoadModule ssl_module libexec/httpd/libssl.so
#LoadModule perl_module libexec/httpd/libperl.so
#LoadModule php4_module libexec/httpd/libphp4.so
LoadModule hfs_apple_module libexec/httpd/mod_hfs_apple.so
--- 235,241 ----
#LoadModule unique_id_module libexec/httpd/mod_unique_id.so
LoadModule setenvif_module libexec/httpd/mod_setenvif.so
#LoadModule dav_module libexec/httpd/libdav.so
! #LoadModule ssl_module libexec/httpd/libssl.so
#LoadModule perl_module libexec/httpd/libperl.so
#LoadModule php4_module libexec/httpd/libphp4.so
LoadModule hfs_apple_module libexec/httpd/mod_hfs_apple.so
***************
*** 279,285 ****
AddModule mod_so.c
AddModule mod_setenvif.c
#AddModule mod_dav.c
! AddModule mod_ssl.c
#AddModule mod_perl.c
#AddModule mod_php4.c
AddModule mod_hfs_apple.c
--- 279,285 ----
AddModule mod_so.c
AddModule mod_setenvif.c
#AddModule mod_dav.c
! #AddModule mod_ssl.c
#AddModule mod_perl.c
#AddModule mod_php4.c
AddModule mod_hfs_apple.c
***************
*** 884,891 ****
#
# To use server-parsed HTML files
#
! AddType text/html .shtml
! AddHandler server-parsed .shtml

#
# Uncomment the following line to enable Apache's send-asis HTTP file
--- 884,891 ----
#
# To use server-parsed HTML files
#
! #AddType text/html .shtml
! #AddHandler server-parsed .shtml

#
# Uncomment the following line to enable Apache's send-asis HTTP file
***************
*** 1105,1128 ****
</IfModule>

Include /private/etc/httpd/users/*.conf
-
-
- # begin entropy.ch PHP module activation
- Include /usr/local/php5/httpd.conf.php
- # end entropy.ch PHP module activation
-
- # begin entropy.ch PHP module activation
- AddType application/x-httpd-php .php
- AddType application/x-httpd-php-source .phps
- DirectoryIndex index.html index.php
- # end entropy.ch PHP module activation
-
- # For prototyping the chesmontastro site.
- Alias / /Users/michaelheinz/Sites/- <Directory "/Users/michaelheinz/Sites/- Options All Includes Indexes MultiViews
- AllowOverride None
- Order allow,deny
- Allow from all
- </Directory>
-
--- 1105,1107 ----
 
Well, seeing that I had these lines commented made me think we were on to something:

/private/etc/httpd% grep ssl httpd.conf
LoadModule ssl_module libexec/httpd/libssl.so
AddModule mod_ssl.c

...but it still made no difference. I usually restart the server with a 'sudo apachectl restart', but I did it both ways (even rebooted) with no effect.

I do run php - how can I use it "instead" of shtml? Sounds like another thread :)

Thanks!

 
Someone in the Apache forum suggested the following, and it worked! Thanks for all the help!


You also need to set
Options +Includes
in the locations/directories where you want to enabled SSI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top