Jump to:

23368 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Moving SS site to another server... no success

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

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

Page: 1
Go to End
Author Topic: 1960 Views
  • Mast4as
    Avatar
    Community Member
    9 Posts

    Moving SS site to another server... no success Link to this post

    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

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: Moving SS site to another server... no success Link to this post

    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.

  • Mast4as
    Avatar
    Community Member
    9 Posts

    Re: Moving SS site to another server... no success Link to this post

    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

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: Moving SS site to another server... no success Link to this post

    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!

  • Mast4as
    Avatar
    Community Member
    9 Posts

    Re: Moving SS site to another server... no success Link to this post

    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 !!!

  • Bruce B
    Avatar
    Community Member
    145 Posts

    Re: Moving SS site to another server... no success Link to this post

    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?

    1960 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.