PHP SSI
Posted by: PaulDiv (---.ts004.bmt.esat.net)
Date: November 16, 2007 03:00PM

I run my web site on a Linux server and use php server side includes for my main menu and page footers.
This saves me lots of time when I need to make changes to my site.

I have tried to run the same site locally using wampserver and the pages are returned to the browser ok but they are not showing the menu and footers.
Has anyone got a fix for this problem?

Paul.



Paul Divers

Options: ReplyQuote
Re: PHP SSI
Posted by: toivo (203.19.130.---)
Date: November 16, 2007 08:54PM

Hi,

Do you mean you use include() statements for the menu and footers? Have you checked that the path is correct? Are there error messages in the log files in c:\wamp\logs?

Do the included scripts perhaps use the short open tag <? instead of <?php ?

Regards,



toivo
Sydney, Australia

Options: ReplyQuote
Re: PHP SSI
Posted by: PaulDiv (---.ts004.bmt.esat.net)
Date: November 16, 2007 09:25PM

Hello Toivo,

I had the problem on my production server but the technical guy fixed
it. Here is what he said:

"I created such .htaccess file within your domain name directory
(following by the URL you gave me):

Options Includes
AddType text/html .html
AddHandler server-parsed .html"

In my html files i call the include like this:

<!-- NAVIGATION -->
<ul id="nav"><li><!--#include file="Menu.html"--></li></ul>
<!-- NAVIGATION END-->

The file Menu.html is a basic HTML list and does not contain PHP tags.

It looks like the htaccess file was the problem at the hosting company
but wamp does not seem to have this file.



Paul Divers

Options: ReplyQuote
Re: PHP SSI
Posted by: PaulDiv (---.ts002.bmt.esat.net)
Date: November 16, 2007 09:59PM

I have this working now.

If you add these three lines to the Directories in httpd.config -

Options Includes
AddType text/html .html
AddHandler server-parsed .html

The server will include html files into existing HTML templates.

I read somewhere that you need a .SHTML extension to use SSI but that is not the case.

So the hosting company added these lines to htaccess and I added them to httpd therefore what is the difference???

I am quite new so any reply will be appreciated.

Paul.



Paul Divers

Options: ReplyQuote
Re: PHP SSI
Posted by: yfastud (---.mia.bellsouth.net)
Date: November 16, 2007 10:33PM

Quote

So the hosting company added these lines to htaccess and I added them to httpd therefore what is the difference???
The effects are the same, the different is .htaccess only have effect on the folder that you have it in; if running live server and host numerous websites, you don't want all your clients having the same effect that they don't need or like, and that's the reason your host create .htaccess for you instead set it in httpd.conf

Have fun,

[test.jlbn.net] (Sample Testing Codes for PHP, MySQL, ASP.net, SQL, JSP)
[www.jlbn.net] (Basic Guide for WAMP & Add-ons)




Post Edited (11-16-07 23:00)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: PHP SSI
Posted by: toivo (203.19.130.---)
Date: November 16, 2007 10:53PM

Hi,

If you use PHP, you could just modify the code slightly to make it work:

<ul id="nav"><li><?php include "Menu.html" ?></li></ul>

Regards,



toivo
Sydney, Australia

Options: ReplyQuote
Re: PHP SSI
Posted by: PaulDiv (---.ts527.cwt.esat.net)
Date: November 16, 2007 11:13PM

Thanks guys. That is a big help. My local and production servers are now both running SSI.
I will need to read up more and keep coming in here to look at the posts.

I was very impressed with the speed of response I got. I am becoming a big fan of open source software and will work at my php and apache skills.



Paul Divers

Options: ReplyQuote
Re: PHP SSI
Posted by: yfastud (---.mia.bellsouth.net)
Date: November 16, 2007 11:34PM

Actually, if you like you can do the same like your host. For example, you have 2 sites: site1 and site2 as follows:

c:/wamp/www/site1
c:/wamp/www/site2

And access them as follows:

[localhost]
[localhost]

Now, you want site1 has HTML menu and site2 has password protection, you can do as follows:

Content for .htaccess in site1:

Options Includes
AddType text/html .html
AddHandler server-parsed .html

Content for .htaccess in site2:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile c:/wamp/www/password/.htpasswd
AuthGroupFile /dev/null
require valid-user

Content for .htpasswd in site2 (assume you have user "tester" and password "test" and save this file in folder c:/wamp/www/password)

tester:test

Have fun,

[test.jlbn.net] (Sample Testing Codes for PHP, MySQL, ASP.net, SQL, JSP)
[www.jlbn.net] (Basic Guide for WAMP & Add-ons)

Options: ReplyQuote
Re: PHP SSI
Posted by: PaulDiv (---.ts004.bmt.esat.net)
Date: November 17, 2007 01:44AM

That is very useful to know yfastud as I can see myself running more than one site on the same host sometime soon.

I have plans for the new year and I am researching ways in which I can make the site scale well.

So far this week I have learned to include menus, headers and footers into html files.
This has been a godsend.

I think it would be really cool to use php for creating automatic breadcrumb trails on my html pages. However I tried a couple of javascripts I found on the web and they returned unexpected results.

I think i need to look at the structure and naming of my directories so that the names are more meaningful.

If anyone knows about php breadcrumbs then it would be great to hear from you.



Paul Divers

Options: ReplyQuote


Sorry, only registered users may post in this forum.