...

View Full Version : How does include_path work?



pandol
12-10-2008, 12:51 AM
I have the following configuration for include_path in my php.ini:

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
include_path = ".;C:\xampp\php\pear\"

Since I am a Windows user what should I do for the following script to output correctly?

<?php
include_once("C:\TEST\myinclude.php");
include_once("myinclude2.php");
include_once("C:\xampp\htdocs\book\13\myinclude2.php");
include_once("C:\xampp\php\PEAR\myinclude2.php")
?>

Keep in mind that there is "myinclude2.php" in both directories:

C:\xampp\htdocs\book\13\ & C:\xampp\php\PEAR\. Also why I see no problem with -- include_once("C:\TEST\myinclude.php");

How should I configure my include_path in my PC to output correctly?

lokeshshettyk
12-10-2008, 08:13 AM
Try this

if my root is /usr/local/apache/share/htdocs

then

assuming i have an inlcudes folder within which I have a config.php

The include statement will be something like this


$docRoot = getenv("DOCUMENT_ROOT");
include $docRoot."/includes/config.php"; // - /usr/local/apache/share/htdocs/includes/config.php


Cheers :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum