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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
LizzyD
Forum Newbie
Posts: 22
Joined: Mon Oct 04, 2004 5:36 am

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

Post 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
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

/blahbalh

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

do:

blahblah
Post Reply