odd basedir() err or

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lkrubner@geocities.com

    odd basedir() err or

    I'm surprised to get an open_basedir error when I'm not only in the
    correct folder for web documents, but I'm an extra layer deep. Basedir
    is usually there to restrict how high up in the directory structure a
    PHP fopen or include statement can reach, yes? The idea is to keep
    someone in a hosted environment from launching an attack by including
    files, or opening them, that are outside of the web environment? How do
    I change the basedir?


    Warning: MkDir failed (Permission denied) in
    /home/httpd/vhosts/publicdomainsof tware.org/httpdocs/setup/neededFiles/writeAllNeededF olders.php
    on line 11

    Warning: open_basedir restriction in effect. File is in wrong directory
    in
    /home/httpd/vhosts/publicdomainsof tware.org/httpdocs/setup/neededFiles/writeAllNeededF olders.php
    on line 12

  • lkrubner@geocities.com

    #2
    Re: odd basedir() err or


    lkrubner@geocit ies.com wrote:[color=blue]
    > I'm surprised to get an open_basedir error when I'm not only in the
    > correct folder for web documents, but I'm an extra layer deep.[/color]
    Basedir[color=blue]
    > is usually there to restrict how high up in the directory structure a
    > PHP fopen or include statement can reach, yes? The idea is to keep
    > someone in a hosted environment from launching an attack by including
    > files, or opening them, that are outside of the web environment? How[/color]
    do[color=blue]
    > I change the basedir?
    >
    >
    > Warning: MkDir failed (Permission denied) in
    >[/color]
    /home/httpd/vhosts/publicdomainsof tware.org/httpdocs/setup/neededFiles/writeAllNeededF olders.php[color=blue]
    > on line 11
    >
    > Warning: open_basedir restriction in effect. File is in wrong[/color]
    directory[color=blue]
    > in
    >[/color]
    /home/httpd/vhosts/publicdomainsof tware.org/httpdocs/setup/neededFiles/writeAllNeededF olders.php[color=blue]
    > on line 12[/color]

    I guess I'm looking for the right .htaccess directive to insert the
    line

    php_admin_value open_basedir none
    Do I look to Apache for this, or www.php.net?

    Comment

    • lkrubner@geocities.com

      #3
      Re: odd basedir() err or

      I fixed this by using DOCUMENT_ROOT and therefore an absolute address,
      rather than a relative one. This is apparently a known bug, you
      sometimes get the open_basedir error when using relative paths.

      In the end I went:

      $root = $GLOBALS["SCRIPT_NAM E"];
      $root = str_replace("se tup.php", "", $root);

      The last line was to get the name of the file out of the directory
      path. Isn't there another way to get the path, without the file name?

      Comment

      • Glenn

        #4
        Re: odd basedir() err or

        lkrubner@geocit ies.com wrote:
        [color=blue]
        > I fixed this by using DOCUMENT_ROOT and therefore an absolute address,
        > rather than a relative one. This is apparently a known bug, you
        > sometimes get the open_basedir error when using relative paths.
        >
        > In the end I went:
        >
        > $root = $GLOBALS["SCRIPT_NAM E"];
        > $root = str_replace("se tup.php", "", $root);
        >
        > The last line was to get the name of the file out of the directory
        > path. Isn't there another way to get the path, without the file name?
        >[/color]

        Use strrpos to find the last position of "/", then substr it from the
        first position to the position returned from strrpos.

        Comment

        • Andy Hassall

          #5
          Re: odd basedir() err or

          On 20 Dec 2004 11:54:15 -0800, lkrubner@geocit ies.com wrote:
          [color=blue]
          >I fixed this by using DOCUMENT_ROOT and therefore an absolute address,
          >rather than a relative one. This is apparently a known bug, you
          >sometimes get the open_basedir error when using relative paths.
          >
          >In the end I went:
          >
          >$root = $GLOBALS["SCRIPT_NAM E"];
          >$root = str_replace("se tup.php", "", $root);
          >
          >The last line was to get the name of the file out of the directory
          >path. Isn't there another way to get the path, without the file name?[/color]


          Returns a parent directory's path


          --
          Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
          <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

          Comment

          Working...