Page 1 of 1

stuck on how to use ini_set("include_path",".

Posted: Thu Sep 29, 2005 2:01 pm
by LizzyD
Hi,

I wonder if anyone can help me? I’m having a bit of trouble with root-relative linking in my php site.

I use a lot of includes in my site whose filepaths, at the moment, are all document relative. However, this is messing with my head and causing all sorts of include-sharing problems so I’d really like to make them all site root relative.

However, on investigation this is not as easy as it sounds. I started by just trying to do a root-relative link in the usual way (i.e. starting with a slash and then the full filepath). However, this only seems to work if I include all the server stuff too:

e.g. I want to write

Code: Select all

include ("/en/header.php");

where /en/ is a top level folder on my local site. However, the include will only work on the live site if I write:

Code: Select all

include ("/home/hotelhea/public_html/en/header.php");

But I obviously don’t want to have to write the whole /home/hotelhea/public_html/ bit for every include in my site as this would drive me crackers.

So, I’ve found out that what I need to do is change the include_path setting in my php.ini file, but my host won’t give me access to do this.

The other option I found was to write:

Code: Select all

ini_set("include_path","/home/hotelhea/public_html");

at the top of every php page. However, for some reason this isn’t working either, and I was just wondering if any experts out there can see where I’m going wrong with it all??

I’d be really grateful for any ideas at all!

Lizzyd

Posted: Thu Sep 29, 2005 3:43 pm
by Ambush Commander
/blahbalh

Means you resolve it from the base of the filesystem, regardless of what your include path is.

do:

blahblah