Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How does include_path work?

    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?

  • #2
    Regular Coder lokeshshettyk's Avatar
    Join Date
    Aug 2008
    Location
    On the way to the moon!
    Posts
    157
    Thanks
    5
    Thanked 20 Times in 20 Posts
    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
    Code:
     $docRoot = getenv("DOCUMENT_ROOT");
     include $docRoot."/includes/config.php"; //  -  /usr/local/apache/share/htdocs/includes/config.php
    Cheers
    Last edited by lokeshshettyk; 12-10-2008 at 07:15 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •