PHP require +open_basedir problem

Ask a Question related to PHP Programming, Design and Development.

  1. #1

    Default PHP require +open_basedir problem

    Hi,
    I'm trying to use simple PHP function (requite) in subfolder but i get error:

    Warning: main() [function.main]: open_basedir restriction in effect. File(./wp-blog-header.php) is not within the allowed path(s): (/usr/local/share/httpd/htdocs/home/:/export/share/httpd/htdocs/home/:/var/tmp/) in /export/share/httpd/htdocs/home/***/wordpress/index.php on line 17

    Warning: main(./wp-blog-header.php) [function.main]: failed to open stream: Not owner in /export/share/httpd/htdocs/home/***/wordpress/index.php on line 17

    Fatal error: main() [function.require]: Failed opening required './wp-blog-header.php' (include_path='.:/usr/local/share/pear') in /export/share/httpd/htdocs/home/***/wordpress/index.php on line 17
    Basicaly speaking, I've got two files:

    1) test.php:
    PHP Code:
    <?php
    require('test2.php');
    ?>
    2) test2.php
    PHP Code:
    <?php
    print('akuku')
    ?>
    when I copy those files to /home/***/ and open test.php everything is fine

    when I copy them to /home/***/wp/ i get the error


    I checked following things:
    -chmod seems to be ok (changed it to 777, but error still occurs)
    -open_basedir value seems to be ok (open_basedir value in phpinfo(): "/home/:/var/tmp/"
    - in phpinfo(): safe_mode off

    Srver specification:
    Apache/1.3.41 (Unix) PHP/4.4.7 mod_ssl/2.8.31 OpenSSL/0.9.8g

    Please help!
    Last edited by gumi_kr; March 14th at 11:02 PM.
    gumi_kr is offline Junior Member
    Join Date
    Mar 2011
    Posts
    2

  2. Similar Questions and Discussions

    1. open_basedir problem
      Hi, on a virtual host, I get the following warning: Warning: is_file() : open_basedir restriction in effect....
    2. #25782 [Opn->Bgs]: require( 'require.php' ) crashing Apache 1.3.28
      ID: 25782 Updated by: sniper@php.net Reported By: akinder at technology-x dot com -Status: Open +Status: ...
    3. #25782 [Fbk->Opn]: require( 'require.php' ) crashing Apache 1.3.28
      ID: 25782 User updated by: akinder at technology-x dot com Reported By: akinder at technology-x dot com -Status: ...
    4. #25782 [Opn->Fbk]: require( 'require.php' ) crashing Apache 1.3.28
      ID: 25782 Updated by: sniper@php.net Reported By: akinder at technology-x dot com -Status: Open +Status: ...
    5. #25782 [NEW]: require( 'require.php' ) crashing Apache 1.3.28
      From: akinder at technology-x dot com Operating system: Linux RedHat 9 PHP version: 5.0.0b1 (beta1) PHP Bug Type: Apache...
  3. #2

    Default Re: PHP require +open_basedir problem

    Looking at the error, it seems like it could be because of permissions.

    Go through the following checklist:
    1. Is wp-blog-header.php located in same directory as index.php?
    2. Is apache running as 'nobody' or in SuExec mode?
    3. Check permissions of wp-blog-header.php, if user 'nobody' and your username is able to access it.
    4. Which user is the owner of both files and folders?

    In most cases Apache would be running as user 'nobody' or your username if running in SuExec mode.
    Ravish is offline S U P E R U S E R
    Join Date
    Aug 2006
    Location
    Internet
    Posts
    21

  4. #3

    Default Re: PHP require +open_basedir problem

    Thank you for your reply!

    1. Yes it is in the same directory
    2. with phpinfo() i get "Server API = Apache " so I think it's not(?)
    3/4. With SCP when I right-click on file I get group: nobody(60001), owner: gumi(479), an I can change chmods evn to 777 but It does not help.
    gumi_kr is offline Junior Member
    Join Date
    Mar 2011
    Posts
    2

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139