open_basedir restriction in effect error in PHP

Discussion in 'PHP' started by BenR41, Feb 25, 2008.

  1. BenR41

    BenR41 New Member

    Joined:
    Feb 6, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    This must be one of the most annoying errors to get when working with php. This error occurs when PHP can't find the specified file in the include statement. This often occurs when a developer has built an application on their machine and uploaded the application to a shared hosting account or if they move the application to a sub folder.

    An easy work around is to determine the path to the called file dynamically.


    $folcnt = substr_count($_SERVER["PHP_SELF"], "/");
    $folappstep = "";
    if($folcnt > 1) {
    for($i=2;$i<=$folcnt;$i++) {
    $folappstep .= "../";
    }
    } else {
    $folappstep = "";
    }

    $extfile = $folappstep."ws8_extensions.php";
    $funfile = $folappstep."ws8_functions.php";

    include $extfile;
    include $funfile;


    Thanks
    Ben
    LTS Media Ltd.
    www.thestreamingmonkey.com
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice