After restoring backup on new server, open_basedir problem

Nextcloud version (eg, 20.0.5):
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): 2.4.56
PHP version (eg, 7.4): PHP 8.1.21

The issue you are facing:
I had to switch server and I did a backup of my Nextcloud installation with tar and did a mysql dump of the database.
After I setup the new server I unpacked the tar.gz to the nextcloud folder and edited the config-file (‘datadirectory’ => ‘/var/www/clients/client1/web1/nextcloud/data’, Database etc.)

When I go to the domain, I get a 500 error. In the error.log I find this:

[Wed Jul 26 17:52:02.792819 2023] [proxy_fcgi:error] [pid 253531:tid 140056532109056] [remote] AH01071: Got error 'PHP message: PHP Warning:  file_exists(): open_basedir restriction in effect. File(/var/www/clients/client4/web6/nextcloud/data/nextcloud.log) is not within the allowed path(s): (/var/www/clients/client1/web1/nextcloud:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/ in /var/www/clients/client1/web1/nextcloud/html/lib/private/Log/File.php on line 61PHP message: PHP Warning:  is_writable(): open_basedir restriction in effect. File(/var/www/clients/client4/web6/nextcloud/data) is not within the allowed path(s): (/var/www/clients/client1/web1/nextcloud:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/ in /var/www/clients/client1/web1/nextcloud/html/lib/private/Log/File.php on line 64'

was the path of the old installation and I have no clue where I need to change this?
I searched in the database and found an entry in oc_storages with the old path. I changed it but it didn’t help.

Open BaseDir is configuerd via ISPConfig: /var/www/clients/client1/web1/nextcloud:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/

Open BaseDir was also configured on the old server, just with the path shown above.

Does anybody know how to solve this?

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'xxxxxx',
  'passwordsalt' => 'xxxxxx',
  'secret' => 'xxxxxx',
  'trusted_domains' => 
  array (
    0 => '',
  'datadirectory' => '/var/www/clients/client1/web1/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  'dbname' => 'xxxx',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxx',
  'dbpassword' => 'xxxxx',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => xxxxx',
  'mail_domain' => 'xxxx',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'xxxx',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxxx',
  'default_phone_region' => 'DE',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '',
    'port' => 6379,
    'timeout' => 0.0,
    'password' => '',
  'opcache.save_comments' => 1,
  'opcache.jit' => 1255,
  'opcache.jit_buffer_size' => '128M',

Help is really appreciated.


Sounds like you basically did this: General troubleshooting — Nextcloud latest Administration Manual latest documentation


The first message would seem to indicate that your configuration change hasn’t taken effect:


Did you restart Apache (and PHP-FPM, if applicable)?

Try to add this to your config.php:

  'logfile' => '/var/www/clients/client1/web1/nextcloud/data/nextcloud.log',

The Logfile is per default in the data directory but it may have been translated to an absolute path and does not change automaticaly when the data dir got changed.

That is my gues.

Hope that helps,
much luck!

Yes, I did basically what is mentioned in the Link you posted.

I restarted Apache, PHP-FPM and also did a server restart. Didn’t help at all.

I added the logfile to the config.phh as @ernolf suggested.

Now I have no entry in the error.log but still get the message, that the server has encountered a problem.

Need to dive deeper into this. I need my files :smiley:

Now I have the following problem:

[Thu Jul 27 07:51:41.346953 2023] [autoindex:error] [pid 424386:tid 140456805512960] [client] AH01276: Cannot serve directory /var/www/apps/: No matching DirectoryIndex (index.html,index.cgi,index.p                                    l,index.php,index.xhtml,index.htm,index.html,index.cgi,,index.php,index.xhtml,index.htm,standard_index.html) found, and server-generated directory index forbidden by Options directive

I found this regarding the problem:

but to be honest, I just don’t understand it

My idea now is the following:

  • New installation of Nextcloud Server
  • Adding user to database
  • Extract the data of users to the data folder
  • Deleting all Nextcloud client connection and re-establish the connection

Could this work?

Because you didn’t mention that:

did you run

occ maintenance:data-fingerprint

after the restore?

read → occ Maintenance commands ←

Yes, but now your nextcloud.log should have details about any remaining problems in it. :slight_smile:

That error is a little suspicious. Isn’t your NC installation in /var/www/clients/client1/web1/nextcloud/? Your apps are located in /var/www/clients/client1/web1/nextcloud/apps I assume?

Do you have an .htaccess file in /var/www/clients/client1/web1/nextcloud? Make sure it didn’t get dropped during the transition and double-check your Apache vhost configuration on the new server.

That did it! You have no clue how thankful I am! Everything work now and I can access my files. I just have to change some settings on the new server now.