Jump to content

open_basedir issue


B3ta
 Share

Recommended Posts

I'm using Runcloud and by default the open_basedir is located at /home/runcloud/webapps/app-sitename/var/lib/php/session:/tmp

I'm constantly getting an error in tracy like:

ErrorException: chdir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/runcloud/webapps/app-sitename:/var/lib/php/session:/tmp) in /home/runcloud/webapps/app-sitename/wire/core/TemplateFile.php:305
 

What do you think that it would be the best path to set the open_basedir in this case, without sacrificing the app security?   

 

Link to comment
Share on other sites

Not sure if you need to change open_basedir at all. The line in question chdir()s back into the directoy PHP was in when TemplateFile::render was invoked, so it is a bit strange that it would go into the root directory at all. Perhaps a chdir("/home/runcloud/webapps/app-sitename"); inside site/ready.php already cures the problem.

Link to comment
Share on other sites

I think this is a SeoMaestro issue...  but thank you for the reply. 

Fatal error: Method SeoMaestro\PageFieldValue::__toString() must not throw an exception, caught ErrorException: chdir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/runcloud/webapps/app-appname:/var/lib/php/session:/tmp) in /home/runcloud/webapps/app-appname/wire/core/Sanitizer.php on line 0

Link to comment
Share on other sites

I have the same issue and no solution yet, but hopefully I can add some more aspects to it. I think it's more accurate to say that SeoMaestro brings the issue to the surface. The whole call stack of the issue is in my case:

ErrorException: chdir(): open_basedir restriction in effect. File(/var/www/php-fcgi-scripts) is not within the allowed path(s): (/var/www/web:/var/www/tmp:/usr/share/php:/tmp) in /var/www/web/wire/core/TemplateFile.php:305
Stack trace:
#0 [internal function]: Tracy\Bar->Tracy\{closure}()
#1 /var/www/web/wire/core/TemplateFile.php(305): chdir()
#2 /var/www/web/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render()
#3 /var/www/web/wire/core/WireHooks.php(823): ProcessWire\Wire->_callMethod()
#4 /var/www/web/wire/core/Wire.php(450): ProcessWire\WireHooks->runHooks()
#5 /var/www/web/site/modules/SeoMaestro/src/StructuredData/BreadcrumbStructuredData.php(55): ProcessWire\Wire->__call()
#6 /var/www/web/site/modules/SeoMaestro/src/StructuredDataSeoData.php(55): SeoMaestro\StructuredData\BreadcrumbStructuredData->render()
#7 /var/www/web/site/modules/SeoMaestro/src/SeoDataBase.php(116): SeoMaestro\StructuredDataSeoData->renderMetatags()
#8 /var/www/web/site/modules/SeoMaestro/src/PageFieldValue.php(97): SeoMaestro\SeoDataBase->render()
#9 [internal function]: SeoMaestro\PageFieldValue->SeoMaestro\{closure}()
#10 /var/www/web/site/modules/SeoMaestro/src/PageFieldValue.php(98): array_map()
#11 /var/www/web/site/modules/SeoMaestro/src/PageFieldValue.php(119): SeoMaestro\PageFieldValue->render()
#12 /var/www/web/wire/core/Sanitizer.php(2929): SeoMaestro\PageFieldValue->__toString()
#13 /var/www/web/wire/core/Sanitizer.php(2058): ProcessWire\Sanitizer->string()
#14 /var/www/web/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php(814): ProcessWire\Sanitizer->entities1()
#15 /var/www/web/site/assets/cache/FileCompiler/site/modules/TracyDebugger/panels/RequestInfoPanel.php(670): RequestInfoPanel->generateOutput()
#16 /var/www/web/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.7.x/src/Tracy/Bar/Bar.php(150): RequestInfoPanel->getPanel()
#17 /var/www/web/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.7.x/src/Tracy/Bar/Bar.php(122): Tracy\Bar->renderPanels()
#18 /var/www/web/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.7.x/src/Tracy/Bar/Bar.php(98): Tracy\Bar->renderHtml()
#19 /var/www/web/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.7.x/src/Tracy/Debugger/Debugger.php(293): Tracy\Bar->render()
#20 [internal function]: Tracy\Debugger::shutdownHandler()
#21 {main}

As we can see in #2, SeoMaestro calls the class ProcessWire\TemplateFile (file is: /wire/core/TemplateFile.php). In line 305 we find:

if($this->savedDir) chdir($this->savedDir);

$this->savedDir is set in line 259:

$this->savedDir = getcwd();

And that's the problem. In my case, getcwd() returns '/var/www/php-fcgi-scripts' – but just sometimes. I have not found what exactly the conditions are when this happens. Maybe SeoMaestro's maintainer @Wanze can shed some light to this.

Link to comment
Share on other sites

  • 6 months later...

Hi! Anyone got any news on this issue?? Gettin git on runcloud too.

EDIT:

Well I did change the render() return  on BreadcrumStructuredData.php on SeoMaestro to this:

return $this->files->render(dirname(dirname(__DIR__)) . '/templates/structured_data_breadcrumb.php', ['listItems' => $this->getListItems()] );

And now it seems to have stopped throwing that error , now I wish I knew why it's different lol

I was completely tripping with this, it's actually only Tracy Debugger the one triggering this issue.

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...