Forum Moderators: coopster

Message Too Old, No Replies

server side include files and PHP

what is the correct form?

         

photocartoonist

12:44 am on Jan 2, 2004 (gmt 0)

10+ Year Member



Happy New Year WW! :)

This first day of the new year has me pondering the correct form of server side includes on a .php page.

For a year on dedicated server, running cpanel this form worked fine:

<? require ("http://someserver/somefile.ext");?>

This also worked for a number of months on a new server running ensim. On this same server this form also worked on the homepage (index.php):

<? require ("./somefile.ext");?>

Then yesterday the site was generating errors for this ssi files and only this works on all pages:

<? require ("/path/to/somefile.ext");?>

and this

<? require ("./somefile.ext");?>

only worked on the homepage of this site but none of the other pages?

I am mystified as to what changed on this server? And now I ask what is the CORRECT form of ssi on a php page, that will work no matter what ensim does.

Any comments on what is the BEST admin interface (meaning most secure and stable) Ensim or Cpanel, would be greatly appreciated.

Thank you.

encyclo

1:09 am on Jan 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not a PHP expert, but this is what I use

<?php include ($_SERVER["DOCUMENT_ROOT"]."/directory/filename.ext");?>

It appears to work everywhere so far ;) I find it useful as the full path is not always the same on different machines.

photocartoonist

1:26 am on Jan 2, 2004 (gmt 0)

10+ Year Member



wow that works too! And I do like that it would be portable too if I move the site. Thank you.