SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot DreamDevil's Avatar
    Join Date
    Nov 2000
    Location
    Belgium
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Use .inc.php file with chrooting

    I have a site with a few subdomains. Each domain is chrooted to a dir (the same as the subdomain-name). In dirA I have a .inc.php file is it possible to use it with require(); ?

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't quite understand the question....require() can include any file that's accessible via the directory structure. You move one level up with a couple of dots: "../../myfile.inc" for example.

  3. #3
    SitePoint Zealot DreamDevil's Avatar
    Join Date
    Nov 2000
    Location
    Belgium
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well that's the problem

    I'm my file seen as /index.php
    but is acutally /dirA/index.php
    I use a subdomain, so dirA.mydomain.com

    Now I want to use a file /dirB/functions.inc.php from dirA.mydomain.com

  4. #4
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't see the problem. If you they're in the same directory structure, it sounds like you need to "move up," and then specify the correct path. Like this:

    "../../dirB/functions.php";

  5. #5
    SitePoint Zealot DreamDevil's Avatar
    Join Date
    Nov 2000
    Location
    Belgium
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need to move up indeed, but that's not possible.


    let say this is the dirstructure

    /
    /DirA
    /DirA/index.php
    /DirB
    /functions.inc.php

    Now I need to require functions.inc.php in index.php

    What do I need to write between the " " in require()?

  6. #6
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    require("../../DirB/functions.inc.php");

    That should do it...although I can't understand the way you've written your structure very well, no offense intended. If it's not possible to move up, however, then it's not possible to include the file until something is changed.

  7. #7
    SitePoint Zealot DreamDevil's Avatar
    Join Date
    Nov 2000
    Location
    Belgium
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    none taken

    I tried it but it didn't work
    with ../DirB/functions.php it did.

    So thanx


Bookmarks

Posting Permissions

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