"open_basedir restriction in effect" after update to 21.0.3 and PHP 7.4

Hi everyone!

I upgraded my cloud today from version 20.0.11 to 21.0.3 on PHP 7.4, MariaDB 10.5 on Ubuntu 18.04 Server

Looking into the the error logs, there are uncountable errors popping up which read exactly the same:

The error occurs just using the application in each single navigation step

“Exception”:“Error”,“Message”:“file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (/APATH/:/tmp/:/dev/urandom:/proc/meminfo) at /APATH/lib/private/Template/Base.php#68”,“Code”:0,“Trace”:[{“function”:“onError”,“class”:“OC\Log\ErrorHandler”,“type”:"::"},{“file”:"/APATH/lib/private/Template/Base.php",“line”:68,“function”:“file_exists”},{“file”:"/APATH/lib/private/legacy/OC_Template.php",“line”:147,“function”:“getAppTemplateDirs”,“class”:“OC\Template\Base”,“type”:"->"},{“file”:"/APATH/lib/private/legacy/OC_Template.php",“line”:89,“function”:“findTemplate”,“class”:“OC_Template”,“type”:"->"},{“file”:"/APATH/lib/private/TemplateLayout.php",“line”:92,“function”:"__construct",“class”:“OC_Template”,“type”:"->"},{“file”:"/APATH/lib/private/legacy/OC_Template.php",“line”:183,“function”:"__construct",“class”:“OC\TemplateLayout”,“type”:"->"},{“file”:"/APATH/lib/public/AppFramework/Http/TemplateResponse.php",“line”:210,“function”:“fetchPage”,“class”:“OC_Template”,“type”:"->"},{“file”:"/APATH/lib/private/AppFramework/Http/Dispatcher.php",“line”:172,“function”:“render”,“class”:“OCP\AppFramework\Http\TemplateResponse”,“type”:"->"},{“file”:"/APATH/lib/private/AppFramework/App.php",“line”:157,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->"},{“file”:"/APATH/lib/private/Route/Router.php",“line”:302,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::"},{“file”:"/APATH/lib/base.php",“line”:993,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->"},{“file”:"/APATH/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::"}],“File”:"/APATH/lib/private/Log/ErrorHandler.php",“Line”:92,“CustomMessage”:"–"

I didnt’t change anything in the surrounding of the working environment and this error was never present in Nextcloud 20.0.11 nor in any previous version.

Looking into the code of the file which throws the error, it seems to be related with the plugins, but I have no further clue.
Might somebody help or has the same issue?

Thanks in advance for the time and efforts!

a PHP specific parameter exists which might be adjusted to get rid of the message:

Hi j-ed.

Sorry for the late reply and thanks for your answer.

This parameter is set for ages and always worked correctly before. The problem exists since the update to version 21.0.3. Nothing changed in the hosting environment.

We always used the following (Plesk)
{WEBSPACEROOT}{/}{:}{TMP}{/}:/dev/urandom

It looks to me that the script is trying to open literally a server root location directory “/templates/” outside it’s legit location, which of course is restricted and shouldn’t even be called. I think this is a bug.

1 Like