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.

Migrating a Site to Silverstripe /

What you need to know when migrating your existing site to SilverStripe.

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

Major Admin Interface issues after server migration


Reply


3 Posts   2827 Views

Avatar
atretes

Community Member, 2 Posts

26 June 2009 at 9:23pm

Hi All

This might be one for the gurus... I am currently developing a site from scratch using the latest v2.3.2-beta1 version of SilverStripe. Why? Because the web site needs to be completely multilingual, en_US and af_ZA. I have two modules that are included, the blog module and image gallery module and I have created a custom theme for the site and modules. Now all works beautifully on my local development server, running XAMPP 2.5, but then I migrate the site to our Hetzner host and put the site in a staging directory and edit the .htaccess file to make sure the RewriteBase is correct.

I run into two snags, the first is that I got the following error:

Fatal error: Cannot use string offset as an array in /usr/www/site/staging/sapphire/core/i18n.php on line 1417

This comes from the _t() function and seems to be something to do with PHP5. I did a lot of hunting to figure out why this error is occurring and managed to fixed the problem with the following code:

if(isset($lang[$locale]))
{
if(isset($lang[$locale][$class]))
{
if(isset($lang[$locale][$class][$realEntity]))
$transEntity = $lang[$locale][$class][$realEntity];
else
$transEntity = $string;
} else
$transEntity = $string;
} else
$transEntity = $string;

Now I'm able to get access to the SilverStripe admin interface but what I notice is that the after the interface is completely loaded and I try creating a new page, or doing anything else, the interface just completely 'hangs' (if I can call it that). I check in Firebug and the AJAX requests are sent successfully and return successfully with the correct update code. I even went as far as doing a Diff on the exact same AJAX response from my local development server and the production server and all looked good, but still the admin interface is not being refreshed.

I then check, in Firebug, to see if all the .js files are loaded properly, all seems to be fine. The only difference that I could spot is that on the production server the admin interface is doing the following request:

GET http://www.site.org/staging/cms/javascript/LangSelect

which fails! This is the only lead that I have to the problem, does anybody perhaps know what might be causing this sort of thing?

I thank you in advance for your input.

Avatar
Ingo

Forum Moderator, 801 Posts

8 July 2009 at 8:01pm

> GET http://www.site.org/staging/cms/javascript/LangSelect
I'm assuming that this URL was truncated by the forum? It should be:
http://www.site.org/staging/cms/javascript/LangSelector.js

> Now all works beautifully on my local development server, running XAMPP 2.5, but then I migrate the site to our Hetzner host
What PHP version do you have at Hetzner? Would you be able to post relevant parts of your phpinfo()?

> Fatal error: Cannot use string offset as an array in /usr/www/site/staging/sapphire/core/i18n.php on line 1417
In which language are you displaying the backend? Could you try to find out the values of all the following variables on the failing call? $locale, $class, $realEntity

Avatar
patrik

Community Member, 9 Posts

18 July 2009 at 1:09am

Edited: 21/07/2009 7:54pm

I also have the silverstripe
Fatal error: Cannot use string offset as an array in <x> i18n.php, error

I have managed to figure out that the $lang variable, which is a global array from the language file, is overwritten with the string "en" somewhere in the code...
I can solve it by placing       
unset($lang);
$lang=array();
require_once("C:/docroot/mysite/site/lang/en_US.php");

in the _t function. But thats not nice at all. Anyone knows where that variable could be overwritten?