1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

open_basedir restriction in effect error in PHP

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

  1. BenR41

    BenR41 New Member

    Feb 6, 2008
    Likes Received:
    Trophy Points:
    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;

    LTS Media Ltd.

Share This Page