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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Moving SS site to another server... no success


Go to End


6 Posts   3304 Views

Avatar
Mast4as

Community Member, 9 Posts

4 July 2011 at 6:32am

Edited: 04/07/2011 6:50am

Dear all

I spend 5 hours today with a friend trying to move an existing SS website to another server. We are doing that because the person who originally developed the website suggested that the reason why we couldn't update it (a dev/build?.... ruins the layout) was maybe because something was wrong with the server it is on at the moment. So we are trying another server on which we have full control.

Now we read quite a few posts on this forum and we followed the rules clearly:

* start a new/fresh SS install. That works
* create new SQL database and import the old one (data) to the new one (it works we checked with phpMyAdmin)
* copied other the modules from the old website (multiselectfield, dataobject_manager, sfwupload and syntaxhl), we also copied themes, assets and mysites.
* we updated the config.php file

<?php

global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
"type" => "MySQLDatabase",
"server" => "xxxx",
"username" => "xxxx",
"password" => "xxxx",
"database" => "xxxx",
);
Security::setDefaultAdmin('admin','xxxxx');
MySQLDatabase::set_connection_charset('utf8');
// Sites running on the following servers will be
// run in development mode. See
// http://doc.silverstripe.com/doku.php?id=devmode
// for a description of what dev mode does.
Director::set_dev_servers(array(
'localhost',
'127.0.0.1',
'mywebsiteonnewserver.com'
));

// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('OURTHEME');

Object::add_extension('SiteConfig', 'CustomSiteConfig');

HtmlEditorConfig::get('cms')->setOption('convert_fonts_to_spans', false);
HtmlEditorConfig::get('cms')->enablePlugins("searchreplace");

HtmlEditorConfig::get('cms')->enablePlugins('syntaxhl');

HtmlEditorConfig::get('cms')->insertButtonsAfter('pasteword', 'syntaxhl');
HtmlEditorConfig::get('cms')->setOption('remove_linebreaks', false);

// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();

//Enable Search
FulltextSearchable::enable();

//Make a data objects sortable (for DOM)
SortableDataObject::add_sortable_classes(array(
'MarketingBlock',
'ShowcaseSlide',
'FAQ'
));

//Unset cache if flushing
if (isset($_GET['flush'])) {
SS_Cache::set_cache_lifetime('any', -1, 100);
}
?>

So we think we have done everything correctly. Then we have done a dev/build?flush=all and the command seemed to run correctly no error. However no matter what we do when we look at the website we seem to be loading a default HOME page not our HOME webpage ????? We just don't know why. We noticed that in the config.php file there's a CustomSiteConfig. When we put that on we can't have access to the admin section anymore. Does anyone know why ?

Anyway we are stuck and we lost 5 hours on something that seems or should be fairly simple... ???? If anyone could help us with that it would be great.

PS when we look at the LOGs we have the following message:

PHP Fatal error:
Call to a member function absoluteLink() on a non-object in /srv/www/xxxxx.com/public_html/mysite/code/Decorators/CustomSiteConfig.php on line 35

Line 35 contains this: $fields->addFieldToTab("Root.Main", new LiteralField("", '<h3 style="padding-top:20px;">IPN URL: <a href="' . DataObject::get_one('IPNPage')->absoluteLink() . '">' . DataObject::get_one('IPNPage')->absoluteLink() . '<a></h3>'));

PS2: should also say that website was developed with SS 2.4.0-rc1 and that the one that we are using on the new server is 2.4.5 so can it be a version conflict problem ?

Cheers

Avatar
swaiba

Forum Moderator, 1899 Posts

4 July 2011 at 7:56am

Edited: 04/07/2011 7:56am

Call to a member function absoluteLink() on a non-object in

relates to the "chaining" here..

DataObject::get_one('IPNPage')->absoluteLink()

which means the dataobject get returns nothing, in other words there is no row in Sitetree with the class name 'IPNPage' - I take it this is because you have taken the code, yet have an empty database? or maybe you have imported the database but the case is different... if the mysql is setup in a way YourTableNames are like that, but they mightbelikethis if it forces lowercase.

Avatar
Mast4as

Community Member, 9 Posts

5 July 2011 at 4:24am

Thanks a lot for your answer... Unfortunately I am too sure to understand what you are suggesting;-) What I am trying to understand is if wether this error I have in the log is responsible for not loading the home page from the selected theme (a default one is loaded). When you speak about database are you talking about the SQL database (the SQL is not empty, we have imported the old one to the new one) or the database that SS builds when you do a dev/build.
Could anyone make other suggestions please ?
Thanks a lot

Avatar
swaiba

Forum Moderator, 1899 Posts

5 July 2011 at 4:33am

Hi Mast4as,

I am sorry that you didn't follow my answer - but I strongly suspect that this is your issue...

Please run the following SQL...

SELECT * FROM SiteTree WHERE ClassName = 'IPNPage';
SELECT * FROM SiteTree_Live WHERE ClassName = 'IPNPage';
SELECT * FROM SiteTree_versions WHERE ClassName = 'IPNPage';

this is searching for a page of the type that I think doesn't exist... I could be wrong... but...

DataObject::get_one('IPNPage')->absoluteLink();

...relies on something being returned form those SQL.

But yes all other ideas are welcome!

Avatar
Mast4as

Community Member, 9 Posts

10 July 2011 at 10:26am

Thanks for your answer. We will look at the SQL database. Haven't done that yet. This is very frustrating situation as apparently moving a website to another seems a fairly simple task. We still can't manage to move it. We tried another technique which is to zip the content from the original file unzip it to the new server. Then update the config file with the new info about the sql database for that server, and create a new SQL database on the new server. Then we flushed it. We still can't get the page for the site. We get the default one.

Also we have this error in the log:

/srv/www/xxxx.com/public_html/htdocs/themes/PIX/templates/images

but we don't have a images dir in temples what we have in the original site are:

Page.ss
Layout/
css/
includes/

So what does it look for a directory that doesn't exist on the new server while this seems to not cause any problem in the current website ?????

Help !!!

Avatar
Bruce B

Community Member, 164 Posts

11 July 2011 at 4:48pm

Moving servers - sometimes its seamless, other times its a pain in the !!!.
At least you can see the PHP errors, thats a good starting point. When you say you see a default home page, what is it you are are seeing?

Did you say you have commented out that CustomSiteConfig?