Includin files in the parent directory

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • davin.pearson@gmail.com

    #1

    Includin files in the parent directory

    Here is my file index.php:

    <?php
    include "../parent.php";
    ?>

    When I try to run this code on a Linux server, it gives me the
    following error message:

    Warning: main(): open_basedir restriction in effect. File(../
    parent.php) is not within the allowed path(s): (.) in \
    \192.168.1.16\w ebfiles\files\2 007-6\1475215\inner \index.php on line 3

    Warning: main(../parent.php): failed to open stream: Operation not
    permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
    \index.php on line 3

    Warning: main(): Failed opening '../parent.php' for inclusion
    (include_path=' .;c:\php\includ es') in \\192.168.1.16\ webfiles\files
    \2007-6\1475215\inner \index.php on line 3

    What gives?

  • anbutu@gmail.com

    #2
    Re: Includin files in the parent directory

    On Jun 16, 2:21 pm, "davin.pear...@ gmail.com"
    <davin.pear...@ gmail.comwrote:
    Here is my file index.php:
    >
    <?php
    include "../parent.php";
    ?>
    >
    When I try to run this code on a Linux server, it gives me the
    following error message:
    >
    Warning: main(): open_basedir restriction in effect. File(../
    parent.php) is not within the allowed path(s): (.) in \
    \192.168.1.16\w ebfiles\files\2 007-6\1475215\inner \index.php on line 3
    >
    Warning: main(../parent.php): failed to open stream: Operation not
    permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
    \index.php on line 3
    >
    Warning: main(): Failed opening '../parent.php' for inclusion
    (include_path=' .;c:\php\includ es') in \\192.168.1.16\ webfiles\files
    \2007-6\1475215\inner \index.php on line 3
    >
    What gives?
    try chmod 555 parent_dir

    Comment

    • Schraalhans Keukenmeester

      #3
      Re: Includin files in the parent directory

      At Sat, 16 Jun 2007 06:21:07 +0000, davin.pearson@g mail.com let h(is|er)
      monkeys type:
      Here is my file index.php:
      >
      <?php
      include "../parent.php";
      ?>
      >
      When I try to run this code on a Linux server, it gives me the
      following error message:
      >
      Warning: main(): open_basedir restriction in effect. File(../
      parent.php) is not within the allowed path(s): (.) in \
      \192.168.1.16\w ebfiles\files\2 007-6\1475215\inner \index.php on line 3
      >
      Warning: main(../parent.php): failed to open stream: Operation not
      permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
      \index.php on line 3
      >
      Warning: main(): Failed opening '../parent.php' for inclusion
      (include_path=' .;c:\php\includ es') in \\192.168.1.16\ webfiles\files
      \2007-6\1475215\inner \index.php on line 3
      >
      What gives?
      Exactly what the first error indicates. You have an open_basedir
      restriction set in your php.ini, which limits file access to files only
      from that directory plus its subdirs.

      PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


      You either have to modify the setting in php.ini or move your include
      file to a directory withing the allowed path.

      HTH


      --
      Schraalhans Keukenmeester - schraalhans@the .Spamtrapexampl e.nl
      [Remove the lowercase part of Spamtrap to send me a message]

      "strcmp('apples ','oranges') < 0"

      Comment

      • davin.pearson@gmail.com

        #4
        Re: Includin files in the parent directory

        On Jun 16, 7:37 pm, Schraalhans Keukenmeester
        <Schraalh...@th e.spamtrapexamp le.nlwrote:
        Here is my file index.php:
        >
        <?php
        include "../parent.php";
        ?>
        >
        When I try to run this code on a Linux server, it gives me the
        following error message:
        >
        Warning: main(): open_basedir restriction in effect. File(../
        parent.php) is not within the allowed path(s): (.) in \
        \192.168.1.16\w ebfiles\files\2 007-6\1475215\inner \index.php on line 3
        >
        Warning: main(../parent.php): failed to open stream: Operation not
        permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
        \index.php on line 3
        >
        Warning: main(): Failed opening '../parent.php' for inclusion
        (include_path=' .;c:\php\includ es') in \\192.168.1.16\ webfiles\files
        \2007-6\1475215\inner \index.php on line 3
        >
        What gives?
        >
        Exactly what the first error indicates. You have an open_basedir
        restriction set in your php.ini, which limits file access to files only
        from that directory plus its subdirs.
        >
        PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

        >
        You either have to modify the setting in php.ini or move your include
        file to a directory withing the allowed path.
        Here is the contents of php.ini.

        open_basedir = /

        When I uploaded it to my ripway.com user account "davin", it still
        gave the same errors when you try to view the following PHP code page:


        Is there an error in my php.ini?

        Is php.ini located in the correct place? Note that I do not have a
        public_html folder.

        Ideally I want php to be able to access all of my folders. What is
        the syntax for specifying multiple dirs to the variable open_basedir?


        Comment

        • Jerry Stuckle

          #5
          Re: Includin files in the parent directory

          davin.pearson@g mail.com wrote:
          On Jun 16, 7:37 pm, Schraalhans Keukenmeester
          <Schraalh...@th e.spamtrapexamp le.nlwrote:
          >>Here is my file index.php:
          >><?php
          >>include "../parent.php";
          >>?>
          >>When I try to run this code on a Linux server, it gives me the
          >>following error message:
          >>Warning: main(): open_basedir restriction in effect. File(../
          >>parent.php) is not within the allowed path(s): (.) in \
          >>\192.168.1.16 \webfiles\files \2007-6\1475215\inner \index.php on line 3
          >>Warning: main(../parent.php): failed to open stream: Operation not
          >>permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
          >>\index.php on line 3
          >>Warning: main(): Failed opening '../parent.php' for inclusion
          >>(include_path ='.;c:\php\incl udes') in \\192.168.1.16\ webfiles\files
          >>\2007-6\1475215\inner \index.php on line 3
          >>What gives?
          >Exactly what the first error indicates. You have an open_basedir
          >restriction set in your php.ini, which limits file access to files only
          >from that directory plus its subdirs.
          >>
          >http://www.php.net/manual/en/feature...i.open-basedir
          >>
          >You either have to modify the setting in php.ini or move your include
          >file to a directory withing the allowed path.
          >
          Here is the contents of php.ini.
          >
          open_basedir = /
          >
          When I uploaded it to my ripway.com user account "davin", it still
          gave the same errors when you try to view the following PHP code page:

          >
          Is there an error in my php.ini?
          >
          Is php.ini located in the correct place? Note that I do not have a
          public_html folder.
          >
          Ideally I want php to be able to access all of my folders. What is
          the syntax for specifying multiple dirs to the variable open_basedir?
          >
          >
          You can't override is parameter in a user's php.ini file. It must be in
          the system one (or Apache configuration), for security reasons.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          Working...