Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2008
    Thanked 0 Times in 0 Posts

    open_basedir restriction in effect error in PHP

    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.
    PHP Code:
    $folcnt substr_count($_SERVER["PHP_SELF"], "/");
    $folappstep "";
    $folcnt 1) {
    $i=2;$i<=$folcnt;$i++) {
    $folappstep .= "../";
    } else {
    $folappstep "";


    LTS Media Ltd.

    Note: This method doesn't check to see if the file exists, and it might be possible to exploit it because there's no filename whitelist.
    Last edited by Inigoesdr; 02-25-2008 at 02:43 PM. Reason: Please use [php] tags and post generalized code examples.


Posting Permissions

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