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

SS3.1 beta3 - SAFE MODE Restriction in effect


Reply


8 Posts   2236 Views

Avatar
Nobrainer Web

Community Member, 137 Posts

2 May 2013 at 7:45pm

Edited: 02/05/2013 10:45pm

Hi,

I need help installing SilverStripe 3 on my host. I have a lot of Silverstripe 2 installations running on the servers at that host, and i would like to continue using them.

The host has safe_mode = on and it has not been a problem before.

When i try to install 3.1 beta3 i get the following error (short version actually is 4 similar errors):

Warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 593 is not allowed to access /var/www owned by uid 505 in /var/www/example.com/public_html/framework/core/Core.php on line 64

I then just go and outcomment framework/core/Core.php line 54 - 64 (they handle Include _ss_environment.php files) after that i get directed to install.php.

Install.php has the following error:

Warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 593 is not allowed to access /var/www owned by uid 505 in /var/www/example.com/public_html/framework/dev/install/install.php5 on line 51

It's again the function for including environment files - i leave it there and silverstripe installs.

Visiting the site now gives the error:

[Warning] is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/local/lib/php/Zend/Translate/Adapter/I18nRailsYamlAdapter.php) is not within the allowed path(s): (/var/www/example.com/:/var/www/tmp/)

I'm stuck

The funny part is that i actually tried the install 2 times, first time i somehow managed to get the system running. Then i decided to try again to be able to document the problems, and now i'm not able to get it running.

I hope that someone will help me and others in the same situation - it's really frustrating not to be able to install my system og choice on my host.

UPDATE: After another install where i just manually opened /install.php, i have the site running, except for a 4 warnings:

Warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 593 is not allowed to access /var/www owned by uid 505 in /var/www/example.com/public_html/framework/core/Core.php on line 64

The problem seems just to be with including the "_ss_environment.php" file - a file i dont even think i'm using.
However, if i outcomment the lines that do the search for _ss_environment.php, i get the error:

[Warning] is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/local/lib/php/Zend/Translate/Adapter/I18nRailsYamlAdapter.php) is not within the allowed path(s): (/var/www/example.com/:/var/www/tmp/)

Avatar
Nobrainer Web

Community Member, 137 Posts

2 May 2013 at 10:45pm

SOLVED!

I surpressed the errors produced by realpath in framework/core/Core.php, by prfixing it with a @.
I then tried to figure out what was going on with the error:

[Warning] is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/local/lib/php/Zend/Translate/Adapter/I18nRailsYamlAdapter.php) is not within the allowed path(s): (/var/www/example.com/:/var/www/tmp/)

My webhost was not able to see any errors produced, site looked ok. I tried from a different browser and no problem???
After removing cookies on my main browser, no errors was produced here either.
I guess something was left in the session - i have no idea what or how that can happen.

Avatar
Nobrainer Web

Community Member, 137 Posts

2 May 2013 at 10:53pm

Setting Director::set_environment_type to dev (Director::set_environment_type("dev");) produces the error again:

[Warning] is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/local/lib/php/Zend/Translate/Adapter/I18nRailsYamlAdapter.php) is not within the allowed path(s): (/var/www/example.com/:/var/www/tmp/)

I prefixed surpressed the warning from is_readable on line 198 of framework/thirdparty/Zend/Loader.php with a @ (if (@is_readable($file)) {) and it's working so far.

Avatar
Liam

Community Member, 470 Posts

24 May 2013 at 2:05am

How did this turn out for you?

I have a client that is hosted on a server with safe_mode on and there is nothing I can do about moving or disabling.

New project so I don't have access yet and want to see if it will work before planning too much.

Avatar
Nobrainer Web

Community Member, 137 Posts

24 May 2013 at 4:19am

Hi Liam,

It is running on the server after the described changes and the performance also seems to be ok.
My solution is hosted at unoeuro.com - and they do say they have special setup in place to try to avoid problems with safe_mode = on.

Avatar
Liam

Community Member, 470 Posts

24 May 2013 at 5:04am

Okay thanks.

I guess I'll move ahead. The issue is that currently they're on a server with < php 5.3 within this company and the company will move the sites to a newer server they have with 5.3+ but cgi+safe_mode. I can't access it until the move so didn't want to do all of this only to find out it won't work, especially since they're charging us a move fee.

And because of politics I can't change webhosts. My only other choice would be to use WordPress or something but I'd rather not.

Fingers crossed but it seems like it should work.

Avatar
gerrut

Community Member, 3 Posts

29 May 2013 at 11:25pm

The problem is probably relating to restrictions on the cace folder. This is easy to solve as follows:

Create a directory in your root and name it like 'silverstripe-cache', the name does not really matter.

CHMOD the directory to 777 (everyone should have write access)

Now create a php file called _ss_environment.php in your root directory. This file should look something like:

<?php
   define('TEMP_FOLDER', '[abspath]/silverstripe-cache');
?>

With [abspath] being the absolute path to the root directory. For example /www/htdocs/mysite .

Hope this helps.

Avatar
PeterNL

Community Member, 9 Posts

7 August 2013 at 1:50am

Thanks that worked out for me.

Greetz Peter