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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Location
    Hong Kong
    Posts
    119
    Thanks
    8
    Thanked 0 Times in 0 Posts

    problem with include path (xampp on Xp)

    I have a problem with include() path!

    I run XAMPP on Xp and tried already many combination, if one works, they other does not.

    Absolute path are:

    c://xampp/htdocs/todo/connect.php");
    c://xampp/htdocs/bom3/css/cssmenu.php");

    From other server would be: http://192.168.0.103/todo/.... etc.


    PHP Code:
    I tried:
    include(
    "connect.php");                    // ok
    include("/bom3/css/cssmenu.php");    // error


    include("connect.php");                    // ok
    include("./bom3/css/cssmenu.php");    // error


    include("connect.php");                    // tries to connect to other db in bom3/
    include("../bom3/css/cssmenu.php");    // ok 

    How can I do that?
    Last edited by fail; 11-25-2010 at 06:31 AM.

  • #2
    New Coder
    Join Date
    Nov 2010
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post
    The top level directory available to include() isn't the docroot of the webserver, meaning that passing /bom3 to include() will tell it to try to look on the filesystem for a directory called /bom3, which will never exist on windows. You will need to pass it the full path:

    PHP Code:
    $bom3_dir 'C:\\xampp\\htdocs\\bom3\\css';
    include( 
    $bom3_dir DIRECTORY_SEPARATOR 'cssmenu.php' ); 

  • Users who have thanked jim_keller for this post:

    fail (11-25-2010)

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Location
    Hong Kong
    Posts
    119
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Thank you!

    I don't really understand it, but this way it works:

    PHP Code:
    $bom3_dir 'C:\\xampp\\htdocs\\bom3\\css';
    include( 
    $bom3_dir DIRECTORY_SEPARATOR 'cssmenu.php' );  

    include(
    "connect.php"); 


  •  

    Posting Permissions

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