php 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
slippyaah
Forum Newbie
Posts: 11
Joined: Wed Jan 14, 2004 5:00 am

php include path

Post by slippyaah »

I'm just trying to set up the .htaccess file to point towards my 'include' directory. I'm working on my local server at the moment (localhost) and don't know the syntax for stating the path on localhost. Here's the contents of my .htaccess file:

php_value include_path ".:localhost/web/website/directory/includes"

The above path is where my include file is on my server but it doesn't show up when I try to access it. Can anyone tell me what's wrong with the above? Does it make a difference if I'm using IIS and have a php.ini file?

slip
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Re: php include path

Post by Roja »

slippyaah wrote:I'm just trying to set up the .htaccess file to point towards my 'include' directory. I'm working on my local server at the moment (localhost) and don't know the syntax for stating the path on localhost. Here's the contents of my .htaccess file:

php_value include_path ".:localhost/web/website/directory/includes"

The above path is where my include file is on my server but it doesn't show up when I try to access it. Can anyone tell me what's wrong with the above? Does it make a difference if I'm using IIS and have a php.ini file?

slip
Yes, IIS does not honor .htaccess files. Thats an apache-specific technique for the most part. (A few other webservers support it, but not IIS).
slippyaah
Forum Newbie
Posts: 11
Joined: Wed Jan 14, 2004 5:00 am

Post by slippyaah »

do I need to specify this in the php.ini file then?

is the syntax I used in the .htaccess file correct to use in the php.ini file?
slippyaah
Forum Newbie
Posts: 11
Joined: Wed Jan 14, 2004 5:00 am

Post by slippyaah »

basically it is for this particular site only. I have a directory like this:

localhost/web/site/sitefolder/

where site is the site I'm working on and sitefolder is the folder with the following 2 folders in:

1) includes
2) public_html

inside public_html I have all of my site contents (including the .htaccess file). e.g.:

images
templates
users
index.php
login.php
.htaccess

etc etc

so I just need to specify a path to the includes directory WITHOUT specifying it for all other web sites which is what making changes to the php.ini file in windows will probably do....?

any thoughts?

slip
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

If you don't have access to php.ini just specify the path when you use include() or require(). In your case:

Code: Select all

include('../includes/filename.ext');
Post Reply