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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

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

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

Include Path Problem


Go to End


21 Posts   9916 Views

Avatar
MagicUK

Community Member, 60 Posts

23 November 2010 at 12:57am

Hey Guys.

I copied over the new Core.php file in the changeset and tried to install. Still getting the same error unfortunately.

Warning: require_once(Zend/Log.php) [function.require-once]: failed to open stream: No such file or directory in /home/issl/public_html/sapphire/dev/Log.php on line 2

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Log.php' (include_path='/usr/lib/php:/usr/local/lib/php:/usr/local/cpanel/3rdparty/lib/php:/tmp:/home:.:/home/issl/php') in /home/issl/public_html/sapphire/dev/Log.php on line 2

Just wondering. Could it be because my clients address has a dash in the domain name? The actual address is http://iss-l.com/ and i'm noticing above that the path is showing ass /home/issl/php

Avatar
Sean

Forum Moderator, 922 Posts

23 November 2010 at 9:29am

Edited: 23/11/2010 9:31am

MagicUK: I think there's something on the host that won't allow you to use set_include_path()

So you've applied the fix from here? http://open.silverstripe.org/changeset/113976

Try this... look for the set_include_path() code in Core.php and put some debugging code in like this:

var_dump('before: ' . get_include_path());

set_include_path(BASE_PATH . '/sapphire' . PATH_SEPARATOR
	. BASE_PATH . '/sapphire/parsers' . PATH_SEPARATOR
	. BASE_PATH . '/sapphire/thirdparty' . PATH_SEPARATOR
	. get_include_path());

var_dump('after: ' . get_include_path());
die();

Could you tell me what the before and after strings show on the screen as after visiting your site with the above code in place?

Mine shows like this:

string 'before: .:/opt/local/lib/php' (length=28)
string 'after: /Users/sharvey/Sites/2.4/sapphire:/Users/sharvey/Sites/2.4/sapphire/parsers:/Users/sharvey/Sites/2.4/sapphire/thirdparty:.:/opt/local/lib/php' (length=148)

If the sapphire paths do not appear in "after" for you, then it is possible the host has disabled the ability to modify the PHP include path.

Cheers,
Sean

Avatar
MagicUK

Community Member, 60 Posts

23 November 2010 at 10:36am

Thanks for the reply Sean. I did as you said and got the following:

"before: /usr/lib/php:/usr/local/lib/php:/usr/local/cpanel/3rdparty/lib/php:/tmp:/home:.:/home/issl/php" string(101) 
"after: /usr/lib/php:/usr/local/lib/php:/usr/local/cpanel/3rdparty/lib/php:/tmp:/home:.:/home/issl/php" 

Avatar
Sean

Forum Moderator, 922 Posts

23 November 2010 at 10:39am

Edited: 23/11/2010 10:43am

My suspicions appear to be correct... your host does not allow you to change the include path, at least not using set_include_path() function in PHP.

Perhaps you could ask them if it's possible another way to add your own paths?

Using .htaccess, something like this:

php_value include_path .:/my/path/here

It's not as good, because it completely overrides the old paths instead of prefixing the new ones to the start.

Sean

Avatar
Sean

Forum Moderator, 922 Posts

23 November 2010 at 10:47am

Edited: 23/11/2010 10:48am

To add the .htaccess value, you'll need to take the output of this from PHP (you can just do the following in Core.php and copy the contents that appear on screen):

var_dump(BASE_PATH . '/sapphire' . PATH_SEPARATOR
	. BASE_PATH . '/sapphire/parsers' . PATH_SEPARATOR
	. BASE_PATH . '/sapphire/thirdparty' . PATH_SEPARATOR
	. get_include_path());

And then place it into the .htaccess file like this:

php_value include_path /home/mysite/sapphire:/home/mysite/sapphire/parsers:/home/mysite/sapphire/thirdparty:/home/mysite/sapphire:/home/mysite/sapphire/parsers:/home/mysite/sapphire/thirdparty:.:/opt/local/lib/php

Make sure it's all on one line.

Hope that helps!

Sean

Avatar
MagicUK

Community Member, 60 Posts

23 November 2010 at 10:50am

Great. Thanks Sean. I'll give that a go. I take it I can add it to anywhere in the .htaccess file? Just append it to the end?

Avatar
Sean

Forum Moderator, 922 Posts

23 November 2010 at 10:56am

Edited: 23/11/2010 10:56am

Should be fine to go anywhere in .htaccess. I usually put php settings at the bottom to keep it tidy.

Avatar
Sean

Forum Moderator, 922 Posts

23 November 2010 at 11:00am

You may also need to put quotes around the value, like this:

php_value include_path "/my/path"