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

Hi,

In the log I found several dozens of this entry:
realpath(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (…) at /volume1/web/Nextcloud/lib/private/Files/Storage/Local.php#57

It is only caused by on user so I’m not sure what it is causing it and how I can solve it.

Do you use the News app? If so see https://github.com/fguillot/picoFeed/issues/284

No, I don’t use the News app.

Some additional info: the user only uses the desktop (Windows) app.
I’ll see if i find there some info in the log.

1 Like

I also have this and i also i don’t use the news app. With release 9.0.5x i have not seen this. For 10.0.0 I am not sure and now I am on 10.0.1.1RC and this happen. I have ask the hoster but this is not a problem with hosted environment.

@Thor Did it came with the update for you too?

realpath(): open_basedir restriction in effect. File(/) is not within
the allowed path(s):
(/var/www/virtual/xxxxxxxxx/:/opt/phpswitcher/php7.0/share/pear/:/dev/urandom)
at
/var/www/xxxxxxxxxxx/owncloud/htdocs/lib/private/Files/Storage/Local.php#57

maybe related to https://github.com/owncloud/core/issues/26033
I will test it and report back.

I think so, I also have not seen it before.

I enabled more detailed logging and found out that it happens to both users but only on a few files and although there is an error, the file gets updated.

Hey guys,
I have the same error. Are there any news about this?

realpath(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (***) at /var/www/nextcloud/lib/private/Files/Storage/Local.php#57

It was fixed and it should be part of the next release 10.0.2:

1 Like

Ah okay, thank you :wink:

Unfortunately after my last update from 12.0.1 to 12.0.3 via cmd line updater i am now having the same issue.

message":“realpath(): open_basedir restriction in effect. File(\/) is not within the allowed path(s): (\/var\/www\/vhosts\/hostingxxxxx.xxxxx.netcup.net\/:\/tmp\/) at \/var\/www\/vhosts\/hostingxxxxx.xxxxx.netcup.net\/httpdocs\/webspace1\/nextcloud\/lib\/private\/Files\/Storage\/Local.php#366”,“userAgent”:“Mozilla\/5.0 (Windows) mirall\/2.3.2 (build 1) (Nextcloud)”,“version”:“12.0.3.3”}

Open a bug report on github.com/nextcloud/server/issues. You probably need some experts to tell you where we try to access /.

Hello Future Nextcloud users,

Its now May 2, 2020 and I had this exact issue these weeks while trying to get nextcloud (version 18) up and running It seemed unsolvable at first but I managed to fix the issue finally after a few long hours of logfiles munching, some google-foo, and good input
from the helpdesk of my hosting provider.

I used the Softaculous auto-installer on the webserver where I rent some space to install NextCloud, however if you install(ed) it manually, just take the data and ignore the Softaculous bit. After installation, when login failed, I got te same error about the realpath open_basedir restriction and invalid path etc. (at a location which the installer had chosen to create all by itself, by the way). For the benefit of future users of NextCloud (and also OwnCloud I believe) here is how I fixed it:

-----------------------------------------------------------------------------------------------------------------------------------

1)
when installing the plugin via Softaculous, in the first lines you fill in the protocol (http/https) and the domainname, and then make sure to fill in a non-existing directory name in the third field. The installer will create it during install, but if you leave it empty, or if you use an existing folder, it can cause problems.

2)
For the second line, give a datadirectory name or leave it default (“nextclouddata”). The installer will then create the datadirectory automagically in a location that is not accessible from the internet: home/_username_/nextclouddata/ (where _username_ is of course your own base account (root) name). And that location is the cause of the open_basedir problem. But we will fix that in a moment.

3)
Lastly, take note of the database name nextcloud wants to use, you will need it later.

.
After the installation Softaculous will report that everyting went well, but if you try to login and get that (by now well known) error message about the realpath open_basedir being at the wrong/illegal location, then you can try this fix:

-> create a directory called “include” in the domains folder (where your sites are also located), like so: ". . . home/_username_/domains/include/ ".

-> now move the nextcloud datafolder to that directory:
". . . home/_username_/domains/include/nextclouddata/ ".

-> Update the new location in two places: first in the nextcloud config file, but equally important: in the database.

You can find the config file usually located at: "…/public_html/nextcloud/config/config.php"
(or replace “nextcloud” with the name of your install folder). In that PHP config file (on line 10) add the new foldernames to the address line:

’datadirectory’ => '/home/_username_/domains/include/nextclouddata/'

-> and last but not least: open phpMyAdmin (or whatever tool you use for database maintenance), locate the nextcloud database (you remembered the db name, right?) , then locate the table called “oc_storage”. There are two entries in that table. In the first entry, in the first field of the first column (called “id”) change the content from: “local:: /home/_username_/nextclouddata” to include the new folders:

local::/home/_username_/domains/include/nextclouddata/

Execute the SQL query to update it, and that’s basically it: you’re done :slight_smile:
You can now navigate your webbrowser to the admin login page (typically http;//domainname,com/nextcloud/index.php) and login with the admin credentials that you filled in when you installed the plugin. Upon logging in, nextcloud will check the config file and the database oc_storage table, it will find the (new) datadir location and check if the directory and it’s contents are there (which they are), it will also check if it can write into that directory (which it can) , and it will think everything is just peachy and it will let you in.

Note1: If you do not use Softaculous, then you are probably well versed in these matters and you can adopt/implement the above information in other ways, fitting your modus operandi.

Note2: *Don’t forget to check if Nextcloud still has write permissions on that datafolder that was moved, and check the owner of the folder. If you download the datafolder, delete the original and re-upload the datafolder to the new location, you now are the new owner of the folder, but my knowledge isn’t good enough to actually comment on this… *

-----------------------------------------------------------------------------------------------------------------------------------

The above worked for me.

However, I can not guarantee it will work for you: there are so many different webserver setups (I think mine is Apache on a Linux box but I’m not even sure) so maybe in your case it might not work, or folder names and locations might be all different. But despite that, you should have enough info to tackle the problem specified to your situation. I’ve spent so much time today hunting down this error and it’s solution that I think it would be good to drop this info here – hopefully it can be of use for future nextcloud/owncloud users that encounter this issue.

-> PS, Yes, I think owncloud has the same bug, and the same solution might work there too, but no guarantees of course :~)

Have a nice day !

Hans.