Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Empty File() breaking open_basedir restriction


Reply


4 Posts   1182 Views

Avatar
ccburns

Community Member, 74 Posts

19 May 2011 at 1:01pm

Edited: 19/05/2011 1:01pm

Hi All,

Sorry for what is normally a simple problem to fix, but...

On transferring my dev site to a PLESK controlled server I am getting a open_basedir error ONLY when I go to the admin section of the site.

The problem with this is it is not actually telling me which file is causing the problem. I have created a silverstripe-cache folder with full write permissions in the webroot but the problem persists and I don't really know where to look to correct given that there doesn't seem to be a file in the File() below.

[Warning] include() [function.include]: open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs/:/tmp/)

Hopefully this isn't too stupid a question to ask... Here is the Full error output.

[Warning] include() [function.include]: open_basedir restriction in effect. File() is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs/:/tmp/)
GET /admin/?flush=all

Line 420 in /var/www/vhosts/domain.com/httpdocs/sapphire/core/SSViewer.php

Source

411                $subtemplate => $subtemplateViewer->process($item, $cache)
412             ));
413          }
414       }
415       
416       $itemStack = array();
417       $val = "";
418       $valStack = array();
419       
420       include($cacheFile);
421
422       $output = $val;      
423       $output = Requirements::includeInHTML($template, $output);
424       
425       array_pop(SSViewer::$topLevel);
426
Trace

SSViewer::process
Line 420 of SSViewer.php
SSViewer->process(Form)
Line 342 of ViewableData.php
ViewableData->renderWith(Array)
Line 1108 of Form.php
Form->forTemplate()
Line 447 of ViewableData.php
ViewableData->XML_val(ImageForm,,1)
Line 84 of .cache.cms.templates.LeftAndMain.ss
include(/var/www/vhosts/domain.com/httpdocs/silverstripe-cache/.cache.cms.templates.LeftAndMain.ss)
Line 420 of SSViewer.php
SSViewer->process(CMSMain)
Line 202 of Controller.php
Controller->handleAction(SS_HTTPRequest)
Line 143 of RequestHandler.php
RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
Controller->handleRequest(SS_HTTPRequest)
Line 282 of Director.php
Director::handleRequest(SS_HTTPRequest,Session)
Line 125 of Director.php
Director::direct(/admin/)
Line 127 of main.php

Avatar
Plato

Community Member, 26 Posts

19 May 2011 at 1:58pm

Edited: 19/05/2011 2:02pm

Gidday mate,

I found that on our server which also runs plesk, I had to chown the silverstripe-cache folder to the webuser (www-data in our case) before apache was able to use it.

mkdir silverstripe-cache
chown www-data:www-data silverstripe-cache

Though that error message seems to be indicating that you're also being denied from your own httpdocs, which seems a bit silly. You may have some stricter permissions around php's File() that you'll have to get sorted.

Also, if you're using 2.4.5 you'll need to patch Folder.php and Upload.php both in sapphire/filesystem:
http://open.silverstripe.org/attachment/ticket/5547/2.4.0-FileUpload.diff

http://open.silverstripe.org/ticket/5547

Hope that helps you out.

Avatar
ccburns

Community Member, 74 Posts

19 May 2011 at 2:02pm

Thanks - this is the first time I am deploying to PLESK, normally I am just deploying on my dedicated server so I already know it works :)

I will also take a look at those patches.

Cheers,
Colin

Avatar
ccburns

Community Member, 74 Posts

19 May 2011 at 2:08pm

So you still need to chown() it even though it has full 0777 permissions on the silverstripe-cache directory. I thought with full permissions anything could read or write to it... Obviously I know nothing about Linux ;)

Thanks again for the help... Will have to get the host to chown() as I don't have access...

Cheers,
Colin