Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Include paths and virtual domains

Status
Not open for further replies.

f117bomb

MIS
Nov 24, 2001
13
US
I have virtual domains setup on my linux apache server along with php. I have my php.ini include path setup like so:

; UNIX: "/path1:/path2"
include_path = ":/var/
Now, when i include a file from site2 such as:

include("config.php");

php will get the config.php from site1 instead of site2 like i want it too. Really what i want to know if there is a way that php can figure out what virtual site is being
acecssed and go to that sites "include" path for any
particular file.

Does that make sence???

So when i include a php file from site1 its include path is site1, an likewise for site2.
 
Why don't you use relative or absolute paths instead of having PHP choose the file it thinks is best? This is possible if you are using Apache and running PHP as a module, just create a .htaccess file in each of your sites root and put this line in it
Code:
php_value include_path ".:/var/[URL unfurl="true"]www/site1"[/URL]
# or ".:/var/[URL unfurl="true"]www/site2"[/URL] for site2
I'm not really sure about the syntax, but it would be somewhat like that. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top