ERROR File(/templates/) is not within the allowed path(s) after update from 20:xx to 21.0.3

I’m getting the following error after the upgrade:

Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (/var/www/vhosts/xxxxx.com/:/tmp/) at /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/Template/Base.php#68

  1. <>OC\Log\ErrorHandler::onError()
  2. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/Template/Base.php - line 68: file_exists()
  3. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/legacy/OC_Template.php - line 147: OC\Template\Base->getAppTemplateDirs()
  4. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/legacy/OC_Template.php - line 89: OC_Template->findTemplate()
  5. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/TemplateLayout.php - line 92: OC_Template->__construct()
  6. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/legacy/OC_Template.php - line 183: OC\TemplateLayout->__construct()
  7. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/public/AppFramework/Http/TemplateResponse.php - line 210: OC_Template->fetchPage()
  8. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 172: OCP\AppFramework\Http\TemplateResponse->render()
  9. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/AppFramework/App.php - line 157: OC\AppFramework\Http\Dispatcher->dispatch()
  10. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/private/Route/Router.php - line 302: OC\AppFramework\App::main()
  11. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/lib/base.php - line 993: OC\Route\Router->match()
  12. /var/www/vhosts/xxxxx.com/httpdocs/nextcloud/index.php - line 37: OC::handleRequest()

I checked that the open_basedir path is correctly configured.

Does anyone has the same problems?

PHP 7.4.21
Maria DB 10.5.11

1 Like

I have the same problem…

Yes, I have the same issue

What is your server system ?

Centos 8, 64bit

I have the same issue. I didn’t help to add /templates and /appinfo to the open_basedir. Also my cron jobs are not running properly due to this issue. any ideas?
I am on Debian Buster with Sury php 7.4.21

Ubuntu 18.04.5
Apache 2.4.29
PHP 7.4.21

Also got this error after update. Adding paths to basedir didn`t help and log still got spammed.
My tempory solution: go back to php7.3

Hope, the next update will fix the problem…

Could be similar/same issue as reported at Lots of Error: file_exists(): open_basedir restriction in effect. in Log · Issue #27759 · nextcloud/server · GitHub

Thanks! The provided solution (changing folder owner) doesnt work for me because of shared hosting. Hope there will be root cause analysis + fix soon.

Have the same problem - no file upload possible.
After update to 21.04
Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s):

Same problem at my NC instance, I’m currently on NC 22.1.0.

Debian 10
Nextcloud 22.2.0
The same problem was solved by
this patch

https://github.com/nextcloud/server/issues/27759#issuecomment-939448312