Jump to:

3444 Posts in 1030 Topics by 871 members

Template Questions

SilverStripe Forums » Template Questions » Problems rebuilding database

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

Page: 1
Go to End
Author Topic: 2648 Views
  • dwainwillis
    Avatar
    Community Member
    5 Posts

    Problems rebuilding database Link to this post

    So I'm really new to SilverStripe and I'm sure my question is probably (hopefully) an easy one. I trying to work my way through the tutorials and unfortunately, I can't make my way past the first one. My problem is when I copy/paste the code for the HomePage.php file and save it into the "mysite/code/" directory it seems to break the site. I perform the database rebuild command "http://localhost:8888/dev/build?flush=1" (I'm using MAMP Pro on a Mac running OS X.5) and it seems to freeze up halfway through the creating database run. I'm not sure if there is a specific change I need to make to MAMP for SilverStripe to work properly. Below is the information displayed on the screen when performing the rebuild.
    Building Database

    Creating database tables

    PageComment
    SiteTree
    Field SiteTree.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
    Field SiteTree_Live.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
    Field SiteTree_versions.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
    Email_BounceRecord
    QueuedEmail
    File
    Group
    LoginAttempt
    Member
    MemberPassword
    Permission
    Widget
    WidgetArea
    EditableCheckboxOption
    EditableDropdownOption
    EditableFormField
    EditableRadioOption
    SubmittedForm
    SubmittedFormField
    Page
    GhostPage
    ArticleHolder
    ArticlePage

  • dwainwillis
    Avatar
    Community Member
    5 Posts

    Re: Problems rebuilding database Link to this post

    Sorry, I forgot to mention that once I've attempted the rebuild, the site no longer works at all. I get a blank screen. I turned on the error reporting for PHP and it reports an T_sytax error on line 6. here is the code from the HomePage.php file.

    <?php
    /**
    * Defines the HomePage page type
    */
    class HomePage extends Page {
    static $db = array(
    );
    static $has_one = array(
    );
    }
    class HomePage_Controller extends Page_Controller {
       function init() {
       parent::init();
    }
    ?>

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Problems rebuilding database Link to this post

    T_sytax error on line 6

    And it was line 6 of HomePage.php? not Page.php?

  • dwainwillis
    Avatar
    Community Member
    5 Posts

    Re: Problems rebuilding database Link to this post

    Below is the output from the rebuild attempt: (below that is the actual HomePage.php code)

    Environment Builder (formerly db/build)
    http://localhost:8888/

    dev→ build
    Building Database

    Creating database tables

    PageComment
    SiteTree
    Field SiteTree.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
    Field SiteTree_Live.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
    Field SiteTree_versions.ClassName: changed to enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','HomePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree' (from enum('SiteTree','Page','GhostPage','ArticleHolder','ArticlePage','ErrorPage','RedirectorPage','VirtualPage','UserDefinedForm') character set utf8 collate utf8_general_ci default 'SiteTree')
    Email_BounceRecord
    QueuedEmail
    File
    Group
    LoginAttempt
    Member
    MemberPassword
    Permission
    Widget
    WidgetArea
    EditableCheckboxOption
    EditableDropdownOption
    EditableFormField
    EditableRadioOption
    SubmittedForm
    SubmittedFormField
    Page
    GhostPage
    ArticleHolder
    ArticlePage

    Parse error: syntax error, unexpected T_CLASS in /Applications/MAMP/htdocs/silverstripe/SilverStripe-v2.3.1/mysite/code/HomePage.php on line 6

    Here is the HomePage.php file:

    <?php
    /**
    * Defines the HomePage page type
    */
     
    class HomePage extends Page {
    static $db = array(
    );
    static $has_one = array(
    );
     
    }
     
    class HomePage_Controller extends Page_Controller {
       
    }
    ?>

  • WildCat
    Avatar
    Community Member
    1 Post

    Re: Problems rebuilding database Link to this post

    Hi There,

    I just ran into this same error... at the same spot in the tutorial.

    If you copy-and-pasted from the web tutorial, you probably picked up some extra hidden characters that php doesn't like. If you can, view the code in a text editor and display "invisibles". You'll see some extra characters, probably for carriage returns.

    Go ahead and delete those.

    If you aren't able to view the hidden characters, simply delete all blank lines in the code. That should also solve the problem.

    I hope this helps.

  • dwainwillis
    Avatar
    Community Member
    5 Posts

    Re: Problems rebuilding database Link to this post

    Thanks WildCat,
    That's exactly what was going on. I deleted everything and re-wrote the code by hand and it worked instantly. Serves me right, for copying and pasting code! Sometimes the easy way isn't always the best. Thanks for the help!

    2648 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.