open_basedir restriction in effect. File() is not within the allowed path(s)

Discussion in 'General' started by MrCompTech, Jan 28, 2011.

  1. MrCompTech

    MrCompTech New Member

    open_basedir restriction in effect. File() is not within the allowed path(s)

    Using ISPConfig3, Fedora 13, Wordpress 3.0.4

    Have severl Wordpress sites, all have this problem.
    Have several Joomla sites with no problems.

    Isn't there supposed to be a file listed in the error message in the parenthesis - 'Files()'?

    This error causes the log files to grow 20KB to 50KB every time a page on the site is displayed including the website admin pages!

    The settings for the website are:

    DOMAIN:
    CGI - unchecked
    SSI - unchecked
    SuEXEC - checked
    Own Error-Documents - unchecked
    Auto-Subdomain - none
    SSL - unchecked
    PHP - Fast-CGI
    Active - Checked

    OPTIONS:
    Linux User - web34
    Linus Group - client1
    Allow Override - All
    PHP open_base_dir -
    /var/www/clients/client1/web34:
    /var/www/clients/client1/web34/web:
    /var/www/clients/client1/web34/tmp:
    /var/www/25freemp3downloads.com:
    /var/www/25freemp3downloads.com/web:
    /srv/www/25freemp3downloads.com/web:
    /usr/share/php5:
    /tmp:
    /usr/share/phpmyadmin

    Apache directives - FcgidMaxRequestLen 5000000

    While troublesghooting this issue I found the error.log file for this website to be 22741993435 bytes long! - Ouch!

    To establish a baseline I:
    disconnected the LAN from the Internet,
    logged out of the wp admin
    had no open browser windows to this web site

    I then open one window to the site http://25freempsdownloads.com

    And checked the log file. It grew by 54304 bytes! This is definitly an uh-oh!

    In the logs the same basic error messages kept repeating over and over and over!
    With only slightly differences that being the file name and the line number -

    [Thu Jan 27 14:01:55 2011] [warn] [client 192.168.1.151]
    mod_fcgid: stderr: PHP Warning: require():
    open_basedir restriction in effect. File() is not within the allowed path(s):
    (
    /var/www/clients/client1/web34:
    /var/www/clients/client1/web34/web:
    /var/www/clients/client1/web34/tmp:
    /var/www/25freemp3downloads.com:
    /var/www/25freemp3downloads.com/web:
    /srv/www/25freemp3downloads.com/web:
    /usr/share/php5:
    /tmp:
    /usr/share/phpmyadmin
    ) in
    /var/www/clients/client1/web34/web/wp-settings.php on line 19

    On error lines a 'referrer' is listed as
    http://25freemp3downloads.com/wp-content/themes/Funda/menu/MenuMatic.css.

    I changed the theme to the default Wordpress theme and the same error messages appeared in the log file and it increase by 98KB.

    In this last error message it seems like it is saying that file being called on line 19 by the script wp-settings.php is not in the path.
    Am I interpreting this error message correctly? It doesn't seem that this could be correct.

    In this error message line 19 is -
    require( ABSPATH . WPINC . '/load.php' );

    Other lines that were referred to in the error messages are -
    line 20 require( ABSPATH . WPINC . '/default-constants.php' );
    line 21 require( ABSPATH . WPINC . '/version.php' );
    line 66 require( ABSPATH . WPINC . '/compat.php' );
    line 67 require( ABSPATH . WPINC . '/functions.php' );
    line 68 require( ABSPATH . WPINC . '/classes.php' );

    The pages come up and they don't seem to be missing anything.

    I 'reset' the error.log file by 'echo > error.log'.
    Is there any way to put a limit on how large the error log will grow?

    To be sure the ownship was correct I ran:
    chown -R web34:client1 /var/www/clients/client1/web34/web

    Anybody have an idea has to what might be causing this?
     
    Last edited: Jan 28, 2011
  2. MrCompTech

    MrCompTech New Member

    A little more investigation shows that it seems like every time a require() function is used an error is generated.
     
  3. MrCompTech

    MrCompTech New Member

    I noticed something else...

    After resetting the web sites error.log file (echo > error.log) and
    then restarting the web server (/etc/init.d/httpd restart)

    Then the first time I visit the web page no errors show up in the log.
    Starting with the second time the site is visited the log file increase by nearly 30KB every time a page is displayed.

    [Thu Jan 27 20:07:16 2011] [warn] [client 192.168.1.151] mod_fcgid: stderr: PHP Warning: require(): open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/clients/client1/web34/web:/var/www/clients/client1/web34/tmp:/var/www/25freemp3downloads.com/web:/srv/www/25freemp3downloads.com/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin) in /var/www/clients/client1/web34/web/wp-settings.php on line 127

    This error occurs 58 times every time the main page is visited.
    One message every time the require() function is used.

    i.e. require( ABSPATH . 'wp-includes' . '/load.php' );

    One really goofy thing with this is that no specific file is mentioned! 'File()', there's nothing in the parenthesis.
    The site works so there's no problem with that. Admin panel works ok. It's just all these open_basedir errors every time the 'require()' function is used.
     
    Last edited: Jan 28, 2011
  4. MrCompTech

    MrCompTech New Member

    So I could see the actual path that was being used I added:
    Code:
    echo ABSPATH . WPINC . '/load.php';
    Just before a line that generates an error.

    The open_basedir is :
    /var/www/clients/client1/web34/web:
    /var/www/clients/client1/web34/tmp:
    /var/www/25freemp3downloads.com/web:
    /srv/www/25freemp3downloads.com/web:
    /usr/share/php5:
    /tmp:/usr/share/phpmyadmin

    The code that I added displayed the full path to the file at the top of the page :
    Code:
    /var/www/clients/client1/web34/web/wp-includes/load.php 
    The file load.php is in the open_basedir.

    I can't figure out why I keep getting this open_basedir warning in the log files!

    The log file was up to 6GB before I caught it.
    There should be something to limit the size of the error.log file of the web site, but I don't know what it is. Anyone know?

    It would be better to fix what ever is wrong so the errors don't occur, but if there's no alternative then I need to do something about the size of the error.log file.
     
    Last edited: Jan 28, 2011
  5. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    If you use a current ispconfig 3 version, then the error.log file gets rotated when it exceeds 10 MB.
     
  6. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Please ensure that all files and folders belong to the correct users by running:

    chown -R web34:client1 /var/www/clients/client1/web34/web/*
     
  7. MrCompTech

    MrCompTech New Member

    Since the error.log file is not getting rotated I can only assume that I am not on the current version. I looked in the ISPConfig 3 interface for a version number but did not see one. So I'll need to upgrade, maybe this will fix the open_basedir issue as well.

    Where is the ISPConfig 3 version number noted?
     
    Last edited: Jan 28, 2011
  8. MrCompTech

    MrCompTech New Member

    Before I had run
    chown -R web34:client1 /var/www/clients/client1/web34/web

    As you suggested I ran
    chown -R web34:client1 /var/www/clients/client1/web34/web/*

    I the ISPConfig 3 server.sh script then restarted httpd.

    After the 2nd refresh of the web page I'm still getting the open_basedir errors.
     
  9. MrCompTech

    MrCompTech New Member

    I updated to ISPConfig 3 v3.0.3.2 but that did not fix the problem.
     
  10. MrCompTech

    MrCompTech New Member

    Tried using using YUM to update the server and then it would not boot.
    Fortunately I use "Clonezilla Live CD" to backup to external USB 1.5TB drive.
    I restored the backup then it still wouldn't boot!
    Found a grub/grub2 rescue CD ISO and used that to easily fix the boot issue.

    That was just FYI, now back to the problem.

    Tried setting the PHP Open_BaseDir for the web site to "/", ran server.sh, restarted httpd but still get the same error message except the open_basedir path is now "/".

    The error message is :
    Code:
    [Tue Feb 01 14:47:39 2011] [warn] [client 192.168.1.151] mod_fcgid: stderr: PHP Warning:  require(): open_basedir restriction in effect. File() is not within the allowed path(s): (/) in /var/www/clients/client1/web34/web/wp-includes/theme.php on line 1088
    When the path begins at the root how can any file not be present?
    Of course the error message doesn't even give a file name.
    But every line number referred by an error message contains a PHP 'require()' function.
     
  11. MrCompTech

    MrCompTech New Member

    I have upgrade both ISPConfig 3 and my server. Now running Fedora Core 14 and still get multiple errors in the error.log file. Only difference is the name of the file and the line number within the file.

    This seems to be some issue with open_basedir and thr PHP rquire function.

    Code:
    [Tue Feb 01 19:06:55 2011] [warn] [client 192.168.1.151] mod_fcgid: stderr: PHP Warning:  require(): open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/clients/client1/web34/web:/var/www/clients/client1/web34/tmp:/var/www/25freemp3downloads.com/web:/var/www/25freemp3downloads.com/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin) in /var/www/clients/client1/web34/web/wp-includes/theme.php on line 1088
    Anyone have any ideas?
     
  12. MrCompTech

    MrCompTech New Member

    Solved - open_basedir

    Information in posts on this forum indicate that when using a Wordpress site on an ISPConfig 3 server to set use SuExec and Fast-CGI.

    But when I switched to the PHP setting to "SuPHP" then the errors stopped. I no longer get 25-30KB of errors in the error.log every time a page is displayed.
     
  13. starmagoo

    starmagoo New Member

    I had the same problem here. Thanks for telling us your solution! :)
     
  14. ph4r05

    ph4r05 New Member

    Solution

    Hi,

    I had the same problem after updating to PHP 5.3.8. Because I don't use suPHP, proposed solution was not right for me (I use httpd-itk).

    After a 2 hours of debugging ang googling I had found that it was eAccelerator what caused this errors. After disabling eAccelerator PHP module everything was fine.

    Because I need some PHP caching I replaced eAccelerator by APC. It works like a charm ;-)

    I hope this will help...
     
  15. gapa

    gapa New Member

  16. tarak

    tarak New Member

    @gapa & ph4r05 many many thanks, I tried to resolve this problem for 2 days but no success. I confirm this eaccelerator module is responsable.

    Very good job guys. :) :)

    Sunbeam from tunisia
     

Share This Page