ISPConfig + open_basedir restriction in effect

Discussion in 'Installation/Configuration' started by 010101, Apr 20, 2011.

  1. 010101

    010101 New Member

    I've been trying to solve this problem for about 2 hours and I don't think I'll understand how to do it on my own.

    I've built this debian system following one of the ISPConfig guides here on howtoforge and I've been using it for other stuff for one month or so, but never hosted a site on this server so far.

    I've tried installing Drupal and Wordpress, but with both I'm getting the same error. (open_basedir)

    Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/var/www/clients/client1/web3/wp-config.php) is not within the allowed path(s):
    (/var/www/clients/client1/web3/web:/var/www/clients/client1/web3/tmp:
    /var/www/domain.net/web:/srv/www/domain.net/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin)
    in /var/www/clients/client1/web3/web/wp-load.php on line 32

    I've uploaded all the files into /var/www/clients/client1/web3/web/

    Could somebody please give me some input? what's wrong?
     
  2. till

    till Super Moderator

    Please post the output of:

    ls -la /var/www/clients/client1/web3/web/
     
  3. 010101

    010101 New Member

    here it is:
    Code:
    ls -la /var/www/clients/client1/web3/web/
    total 240
    drwx--x--- 7 web3 client0  4096 Apr 19 23:54 .
    drwxr-x--x 9 web3 client1  4096 Apr 19 19:11 ..
    drwxr-xr-x 2 root root     4096 Apr 19 23:54 error
    -rw-r--r-- 1 web3 client1   397 Apr 19 23:41 index.php
    -rw-r--r-- 1 web3 client1 15606 Apr 19 23:41 license.txt
    -rw-r--r-- 1 web3 client1  9202 Apr 19 23:41 readme.html
    drwxr-xr-x 2 root root     4096 Apr 20 00:30 stats
    -rw-r--r-- 1 web3 client1  4337 Apr 19 23:41 wp-activate.php
    drwxr-xr-x 9 web3 client1  4096 Apr 19 23:43 wp-admin
    -rw-r--r-- 1 web3 client1 40283 Apr 19 23:41 wp-app.php
    -rw-r--r-- 1 web3 client1   226 Apr 19 23:41 wp-atom.php
    -rw-r--r-- 1 web3 client1   274 Apr 19 23:41 wp-blog-header.php
    -rw-r--r-- 1 web3 client1  3931 Apr 19 23:41 wp-comments-post.php
    -rw-r--r-- 1 web3 client1   244 Apr 19 23:41 wp-commentsrss2.php
    -rw-r--r-- 1 web3 client1  3177 Apr 19 23:41 wp-config-sample.php
    drwxr-xr-x 4 web3 client1  4096 Apr 19 23:43 wp-content
    -rw-r--r-- 1 web3 client1  1255 Apr 19 23:41 wp-cron.php
    -rw-r--r-- 1 web3 client1   246 Apr 19 23:41 wp-feed.php
    drwxr-xr-x 8 web3 client1  4096 Apr 19 23:45 wp-includes
    -rw-r--r-- 1 web3 client1  1997 Apr 19 23:41 wp-links-opml.php
    -rw-r--r-- 1 web3 client1  2453 Apr 19 23:41 wp-load.php
    -rw-r--r-- 1 web3 client1 27787 Apr 19 23:41 wp-login.php
    -rw-r--r-- 1 web3 client1  7774 Apr 19 23:41 wp-mail.php
    -rw-r--r-- 1 web3 client1   494 Apr 19 23:41 wp-pass.php
    -rw-r--r-- 1 web3 client1   224 Apr 19 23:41 wp-rdf.php
    -rw-r--r-- 1 web3 client1   334 Apr 19 23:41 wp-register.php
    -rw-r--r-- 1 web3 client1   224 Apr 19 23:41 wp-rss.php
    -rw-r--r-- 1 web3 client1   226 Apr 19 23:41 wp-rss2.php
    -rw-r--r-- 1 web3 client1  9655 Apr 19 23:41 wp-settings.php
    -rw-r--r-- 1 web3 client1 18644 Apr 19 23:41 wp-signup.php
    -rw-r--r-- 1 web3 client1  3702 Apr 19 23:41 wp-trackback.php
    -rw-r--r-- 1 web3 client1  3210 Apr 19 23:41 xmlrpc.php
    
     
  4. till

    till Super Moderator

    Thats ok so far, wordpress is just not fully installed yet. The next step to install wordpress are:

    1) Make a copy of the file wp-config-sample.php and name it wp-config.php
    2) Edit the file wp-config.php and change the database login details inside so that they match the database name, user and password of your database.

    Then open the wordpress installer in the webbrowser and follow the instructions in the installer.

    As a sidenote: Ensure that you use the correct PHP method. For CMS systems you should use "PHP-FCGI" and the suexec checkbox must be enabled.
     
  5. 010101

    010101 New Member

    thank you till ;)

    the weird thing is that, if you don't have a wp-config.php file, it is usually created during the installation process, instead this is throwing that error in the page where the installation begins.

    Sure the method you mentioned would make it work in a fingersnap, but I'm more interested in getting the server configured as it should rather than in a quick fix.

    The website has suexec enabled and php set to fastcgi

    If I understand correctly I should do one of the following:

    - disable open_basedir (how? can it be done from within ISPConfig?)
    - properly configure open_basedir paths in order for it not to throw the error
    no clue how to do it, the current settings are:
    website options: /var/www/clients/client1/web3/web:/var/www/clients/client1/web3/tmp:/var/www/impiantivideosorveglianza.net/web:/srv/www/impiantivideosorveglianza.net/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin
    server config: [website_path]/web:[website_path]/tmp:/var/www/[website_domain]/web:/srv/www/[website_domain]/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin
     
  6. till

    till Super Moderator

    The problem is misbehaviour in wordpress and not a wrong setting in ispconfig. If wordpress does not find its config file, it tries to traverse the path downwards and tries to find the file wp-config.php in other locations. So wordpress tries to open folders that it is not allowed too because they are outside of its web directory and this triggers the open_basedir.

    You can disable open_baesdir of course by simply setting / as open_basdir path, but thst quite insecure as it allows all your website users to read the mysql passwords and other data of other websites.
     
  7. Julian

    Julian New Member

    Hello,

    I have the same issue! I have ISPConfig Version: 3.0.5.3

    and I have this error:
    Warning: Unknown: open_basedir restriction in effect. File(/var/www/clients/client1/web32/web/index.html) is not within the allowed path(s): (/usr/share/php:/usr/lib/roundcube:/etc/roundcube:/usr/share/roundcube:/var/lib/roundcube:/var/log/roundcube) in Unknown on line 0 Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0 Fatal error: Unknown: Failed opening required '/var/www/xxxxxx.xxx/web/index.html' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

    In /etc/apache2/sites-available/website.com.vhost I dont have the open_basedir!
    If I add it then the roundcube dosn't work anymore!!!

    [Tue Jan 28 13:16:40 2014] [error] [client xx.xx.xx.xx] PHP Warning: is_file(): open_basedir restriction in effect. File(/var/lib/roundcube/config/main.inc.php) is not within the allowed path(s): (/var/www/clients/client1/web21/web:/var/www/clients/client1/web21/tmp:/var/www/xxxxx.xxx/web:/srv/www/xxxxxxxx.xxx/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/usr/share/roundcube:/usr/share/php) in /usr/share/roundcube/program/include/rcube_config.php on line 137


    Can some one help me please!?
     
    Last edited: Jan 29, 2014
  8. till

    till Super Moderator

    you must have modified the open_basedir settings in the website or the glovbl setting in ispconfig, as all website paths are mising that ispconfig adds by default.

    to fix this for this site, add:

    :/var/www/clients/client1/web32/web

    at the end of the open_basedir field of the website. and do not odify any vhost or php config files of the site manually, this will just break your setup!
     
  9. Julian

    Julian New Member

    Thank you till for your replay!

    Can you please tell me where to add the:
    :/var/www/clients/client1/web32/web
    ???

    Because in ispconfig/website/option at the PHP open_basedir, I already have that!
     
  10. Julian

    Julian New Member

    Can you please tell me where the open_basedir is set? I can't find it and some websites dost work!

    If I dont need to change the vhost manually then where to edit?

    Please help me!
     
  11. till

    till Super Moderator

    The open_basedir is set on the options tab of the website in ispconfig.
     
  12. Julian

    Julian New Member

    I have it set in options tab of the website in ispconfig, but dosnt take it!
    Can you tell me why?

    And what I can do to fix it?
     
  13. till

    till Super Moderator

    Which php mode do you use? recommended is php-fcgi or php-fpm and suexec should be activated. Are there any jobs listed in the jobqueue of the monitor?
     
  14. Julian

    Julian New Member

    I'm using php fast-CGI.
    Are there any jobs listed in the jobqueue of the monitor?
    No
     
  15. till

    till Super Moderator

    ok. So all changes should be processed. check the fcgi starter file of the website in

    /var/www/php-fcgi-scripts/web1/.php-fcgi-starter

    replace the 1 in web1 with the id of the website.
     
  16. Julian

    Julian New Member

    Its writing to that file but dosn't apply the settings!!!
    Can I give you the login to take a look please? I don't know what to do to fix it!

    Thank you
     
  17. till

    till Super Moderator

    I can check this by remote login, but this would fall under our commercial support services. You can reach our commercial support here:

    http://support.projektfarm.com

    you can e.g. try to stop apache, check if really all apache processes are gone in ps output and then start it again. and you can check in phpinfo() output of this website if php si really executed as cgi / fcgi and not e.g. as mod_php.
     
  18. Julian

    Julian New Member

    I reboot the server! same thing!

    Warning: Unknown: open_basedir restriction in effect. File(/var/www/clients/client1/web32/web/index.html) is not within the allowed path(s): (/usr/share/php:/usr/lib/roundcube:/etc/roundcube:/usr/share/roundcube:/var/lib/roundcube:/var/log/roundcube) in Unknown on line 0 Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0 Fatal error: Unknown: Failed opening required '/var/www/xxxxxx.xxx/web/index.html' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0


    how much will you charge me to fix it?
     
    Last edited: Jan 28, 2014
  19. till

    till Super Moderator

    The open basedir is set correctly, you can se eit in the phpinfo() output. Is the file index.html a php or a html file? only .php files get executed with the fcgi php. maybe your site tries to enable mod_php in a .htaccess file of the web directory for .html files instead of useing php fcgi.
     
  20. Julian

    Julian New Member

    in the .htaccess I have only: AddType application/x-httpd-php .html .htm
    the index.html is only simple html code!

    I saw that this problem is only to html files!

    I delete the htaccess file and the site is working but the .html files cant execute php code now!

    How can I make the html files to execute php code without to have the open_base error?
     

Share This Page