+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Need Help php error

  1. #1
    ddeswal293 is offline x10Hosting Member ddeswal293 is an unknown quantity at this point
    Join Date
    Jun 2010
    Posts
    2

    Unhappy Need Help php error

    Hi,i am new here i need help
    i made a script it works fine for some days but today when i open my site it give me a error

    Warning: include() function.include]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/54353.php) is not within the allowed path(s): (/home/:/tmp) in <b>/home/ddeswal2/public_html/index.phpon line 81

    Warning: include(/usr/local/apache/htdocs/54353.php) function.include]: failed to open stream: Operation not permitted in /home/ddeswal2/public_html/index.php on line 81

    Warning: include() [function.include]: Failed opening '/usr/local/apache/htdocs/54353.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ddeswal2/public_html/index.php on line 81

    i added this code to my index.php
    <?php
    include $_SERVER['DOCUMENT_ROOT'] . '/54353.php';
    ?>

  2. #2
    bhupendra2895's Avatar
    bhupendra2895 is offline x10 Elder bhupendra2895 is an unknown quantity at this point
    Join Date
    Jun 2010
    Location
    India
    Posts
    554

    Re: Need Help php error

    Quote Originally Posted by ddeswal293 View Post
    <?php
    include $_SERVER['DOCUMENT_ROOT'] . '/54353.php';
    ?>
    Change it to this, if file resides in public_html folder

    PHP Code:
    <?php 
     
    include '/home/ddeswal2/public_html/54353.php';
     
    ?>
    And you can simply do this too


    PHP Code:
    <?php 
     
    include '54353.php';
     
    ?>
    Last edited by bhupendra2895; 07-11-2010 at 05:13 AM.
    Liked this? Click on the icon on the bottom of post to make me .

  3. #3
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

    Re: Need Help php error

    Quote Originally Posted by bhupendra2895 View Post
    And you can simply do this too


    PHP Code:
    <?php 
     
    include '54353.php';
     
    ?>
    ... if and only if the page in question resides in the root directory -- and, let's face it, if you have documents of multiple types (or multiple categories of documents) and they all appear to be in the same directory, your URLs will wind up being far from friendly.

    Requiring us to hard-code our public HTML directory is an unfortunate misconfiguration decision IMHO. We were, until recently, able to use $_SERVER["DOCUMENT_ROOT"] to point to the public HTML directory for our accounts, and that is the only sane way to set up a shared server. The PHP you write should require the minimum possible amount of configuration to move from server to server, and with this move we are being forced to hardcode a path to even get to a configuration file. Not very user (or developer) friendly.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

  4. #4
    bhupendra2895's Avatar
    bhupendra2895 is offline x10 Elder bhupendra2895 is an unknown quantity at this point
    Join Date
    Jun 2010
    Location
    India
    Posts
    554

    Re: Need Help php error

    Quote Originally Posted by essellar View Post
    Requiring us to hard-code our public HTML directory is an unfortunate misconfiguration decision IMHO. We were, until recently, able to use $_SERVER["DOCUMENT_ROOT"] to point to the public HTML directory for our accounts, and that is the only sane way to set up a shared server. The PHP you write should require the minimum possible amount of configuration to move from server to server, and with this move we are being forced to hardcode a path to even get to a configuration file. Not very user (or developer) friendly.
    I thought that $_SERVER["DOCUMENT_ROOT"] can't be available in shared hosting therefore this weird error (in bold text inside quote)was generated.
    Warning: include() [function.include]: Failed opening '/usr/local/apache/htdocs/54353.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ddeswal2/public_html/index.php on line 81
    It is really unfortunate because it will require more amount of configuration.Is this not available because php is not installed here as apache's module?
    Last edited by bhupendra2895; 07-11-2010 at 06:11 AM.
    Liked this? Click on the icon on the bottom of post to make me .

  5. #5
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228
    Fairly certain $_SERVER[]; is enabled.. It looks like the OP was using something like XAMPP to code on his home server and hardcoded the path..

    OP:

    What server are you on?
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  6. #6
    DeadBattery's Avatar
    DeadBattery is offline Community Support Team DeadBattery is a name known to allDeadBattery is a name known to all
    Join Date
    Mar 2008
    Location
    localhost
    Posts
    4,019

    Re: Need Help php error

    @leafypiggy: Starka

    @ddeswal293: where is 54353.php in relation to index.php ?


  7. #7
    dlukin is offline x10 Lieutenant dlukin is on a distinguished road
    Join Date
    Oct 2009
    Posts
    427

    Re: Need Help php error

    Quote Originally Posted by leafypiggy View Post
    Fairly certain $_SERVER[]; is enabled.. It looks like the OP was using something like XAMPP to code on his home server and hardcoded the path..
    Yes, it is enabled.

    And bhupendra2895 is right. When you guys fiddled with the settings,
    $_SERVER[ 'DOCUMENT_ROOT' ]is now set to '/usr/local/apache/htdocs'
    for everybody. It does not point to '/home/cPanelUsername/public_html' like it did before.

    It is the same problem that now requires any mod_rewrite code to use
    RewriteBase / in order to function properly.
    Last edited by dlukin; 07-11-2010 at 08:30 AM.

  8. #8
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228
    Quote Originally Posted by dlukin View Post
    Yes, it is enabled.

    And bhupendra2895 is right. When you guys fiddled with the settings,
    $_SERVER[ 'DOCUMENT_ROOT' ]is now set to '/usr/local/apache/htdocs'
    for everybody. It does not point to '/home/cPanelUsername/public_html' like it did before.

    It is the same problem that now requires any mod_rewrite code to use
    RewriteBase / in order to function properly.
    You should be defining your rewrite base anyways.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  9. #9
    dlukin is offline x10 Lieutenant dlukin is on a distinguished road
    Join Date
    Oct 2009
    Posts
    427

    Re: Need Help php error

    Quote Originally Posted by leafypiggy View Post
    You should be defining your rewrite base anyways.
    Well, when Staff fiddled with the settings they broke a lot of scripts. Which is funny because one of the reasons cited for not upgrading Python/PHP versions has been that it would "break existing scripts".

  10. #10
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228
    How do you know, and when did we "fiddle" with scripts?
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 05-16-2010, 02:09 PM
  2. Replies: 2
    Last Post: 04-15-2010, 07:44 PM
  3. Replies: 4
    Last Post: 12-22-2009, 04:39 PM
  4. Replies: 1
    Last Post: 03-03-2008, 10:58 AM
  5. Replies: 1
    Last Post: 09-01-2007, 02:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers