Page 1 of 1

php include path

Posted: Mon May 16, 2005 2:45 pm
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

Re: php include path

Posted: Mon May 16, 2005 2:53 pm
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).

Posted: Mon May 16, 2005 3:01 pm
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?

Posted: Mon May 16, 2005 3:08 pm
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

Posted: Mon May 16, 2005 4:13 pm
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');