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

[SOLVED] SS3 installation error: [Warning] is_readable(): open_basedir restriction in effect


Reply

22 Posts   8490 Views

Avatar
Optic Blaze

26 October 2012 at 8:12am Community Member, 162 Posts

Ok seemed to have found the file that contains the address to the "/usr/share/pear/Zend/Translate/Adapter/I18nRailsYamlAdapter.php" file. It is located in 'framework/i18n/i18TextCollector.php'

On line 516 it seems that a language file is written for the i18nRailsYamlAdapter. Just need to figure out how to change the directory that the file is created to to '/usr/share/php'

Avatar
Ingo

30 October 2012 at 12:31pm Forum Moderator, 801 Posts

i18n.php calls require_once 'i18nRailsYamlAdapter.php';
This should go through the include paths, starting with the current directory, and find the file in framework/i18n/i18nRailsYamlAdapter.php
Does this file exist for you? If it doesn't, PHP will continue traversing the include_path parts.
Please try adding ".:" (without the quotes) at the start of your include_path setting.
I've tried to prevent this config error in the future by making the require_once directives a bit more specific:
https://github.com/silverstripe/sapphire/pull/904

Avatar
Optic Blaze

30 October 2012 at 8:21pm Community Member, 162 Posts

Hi Ingo thanks for the reply, i really appreciate it.

1) I checked and the 'framework/i18n/i18nRailsYamlAdapter.php' exists
2) I dont know if this is relevant but i thought that i should mention that this test site is in a subdirectory of a webiste
that is running SS2.5.
So the main site runs on 'www.mysite.com' (SS2.5) and this test site runs under 'www.mysite.com/ss3' (SS3.02)

------------------------------------------------------------------------------

As per your suggestion tried the following:

in the i18.php file i changed the require_once call from
require_once 'i18nRailsYamlAdapter.php';
// to
require_once '.:i18nRailsYamlAdapter.php';

i had the following error:

Warning: require_once(.:i18nRailsYamlAdapter.php): failed to open stream: No such file or directory in /usr/www/users/opticb/customers/diveschoolcapetown/framework/i18n/i18n.php on line 3 Fatal error: require_once(): Failed opening required '.:i18nRailsYamlAdapter.php' (include_path='/usr/www/users/opticb/customers/diveschoolcapetown/framework:/usr/www/users/opticb/customers/diveschoolcapetown/framework/parsers:/usr/www/users/opticb/customers/diveschoolcapetown/framework/thirdparty:.:/usr/share/php:/usr/share/pear') in /usr/www/users/opticb/customers/diveschoolcapetown/framework/i18n/i18n.php on line 3

-----------------------------------------------------------------------------------------

Then i tried making the changes you showed on GITHUB to the i18.php

require_once 'Zend/Translate.php';

// Overrule Zend_Loader
require_once FRAMEWORK_PATH . DIRECTORY_SEPARATOR . 'i18n' . DIRECTORY_SEPARATOR . 'i18nRailsYamlAdapter.php';
require_once FRAMEWORK_PATH . DIRECTORY_SEPARATOR . 'i18n' . DIRECTORY_SEPARATOR . 'i18nSSLegacyAdapter.php';

And got the following error

[Warning] is_readable(): open_basedir restriction in effect. File(/usr/share/pear/Zend/Translate/Adapter/I18nRailsYamlAdapter.php) is not within the allowed path(s): (/usr/wwws/users/opticb:/usr/www/users/opticb:/usr/home/opticb:/usr/local/rmagic:/usr/www/users/he/_system_:/usr/share/php:/usr/local/lib/php:/tmp:/usr/bin:/usr/local/bin:/usr/local/share/www:/usr/share/misc)
GET /customers/diveschoolcapetown/dev/build?flush=1

Line 198 in /usr/www/users/opticb/customers/diveschoolcapetown/framework/thirdparty/Zend/Loader.php
------------------------------------------------------------------------------------

Avatar
Ingo

30 October 2012 at 10:44pm Forum Moderator, 801 Posts

The ".:" needs to go at the start of your "include_path" PHP configuration setting, not the require_once() call.
As for the last error message you're getting, that's really really weird. The changed require_once() call
contains an absolute path to the file in your webroot, nothing in the /usr directory.
Running the website in a subdirectory of another SS installation shouldn't have an effect on this specific
problem, although its generally not a good idea due to autoloading issues.
Would be good to get a stacktrace on your last error, but otherwise I'm out of ideas.

Avatar
Optic Blaze

31 October 2012 at 12:35am Community Member, 162 Posts

Thanks for the reply.

I have included a stack trace (i hope i did it right).

Out of pure frustration i went and commented out line 200 - 204 in Thirdparty/Zend/Loader.php (see below).

I then tested if the following files still loaded. They did load.
Zend/Translate.php
i18nRailsYamlAdapter.php
i18nSSLegacyAdapter.php

I dont get the open base error any more. I dont know what else to do.... i just hope this wont bite me in the ass later.

-------------------------------------------------------------------------------------
Thirdparty/Zend/Loader.php now it looks like this:

foreach (self::explodeIncludePath() as $path) {
if ($path == '.') {
if (is_readable($filename)) {
return true;
}
continue;
}
/*         $file = $path .'/' . $filename;
if (is_readable($file)) {
return true;
}*/

}
return false;
}

Attached Files
Avatar
Ingo

2 November 2012 at 9:28am Forum Moderator, 801 Posts

We've merged in a fix which forces the current directory to be part of the include_path: https://github.com/silverstripe/sapphire/pull/916#issuecomment-9994541

Avatar
Optic Blaze

2 November 2012 at 9:50am Community Member, 162 Posts

Thanks Ingo, i really appreciate it. I was really stuck there at one stage.
That solved the problem!!!!

Avatar
Petrus

12 November 2012 at 10:47pm Community Member, 3 Posts

I have a similar but unsolved issue.

The warning message has led me seriously astray and I've looked in many places to do with /usr/share/pear and /usr/share/pear-addons thinking I was missing something there. This subject seems to fit a lot better with my actual problem!

I was converting a ss 2.4 to ss3.0.2

Once I have deleted CMS and Silverstripe directories and copied CMS and framework from version 3 in (along with .htaccess and index.php) and run {site]/dev/build/?flush=1 I get the following error:

[Warning] is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/pear-addons/Zend/Translate/Adapter/I18nRailsYamlAdapter.php) is not within the allowed path(s):

You can see why I was led astray!!!

But reading the posts in this subject in the forums has given me a clue. The file l18mRailsYamlAdapter.php is NOT in the {webroot}/framework/Zend/Translate/Adapter directory it is looking in so therefore is searching further along the allowed paths and doesn't find it in any of them either, eventually giving up with the open_BaseDir error

The site has userforms module. I deleted it and downloaded the latest version whcih said it was compatible with ss v3.0

Any help would be immensely appreciated.

Cheers
Pete