Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Installation Error: Cannot redeclare class Datetime

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 3540 Views
  • gakenny
    Avatar
    Community Member
    153 Posts

    Installation Error: Cannot redeclare class Datetime Link to this post

    Hello,

    I have commented out the line of code to check the memory size as my host has stated that the memory size is 32M (although no size is reported).

    I now have another error in the installation:
    Fatal error: Cannot redeclare class Datetime
    in /home/xxxxxxxx/public_html/silverstripe/sapphire/core/model/fieldtypes/Datetime.php on line 27

    Has anyone else encountered this error?

    Cheers,

    Gary

  • gakenny
    Avatar
    Community Member
    153 Posts

    Re: Installation Error: Cannot redeclare class Datetime Link to this post

    Hello,

    It seems that the answer to this issue is located here:
    http://www.php.net/UPDATE_5_2.txt

    'With the advent of PHP 5.2, there are object representations of the date and
    timezone, named DateTime and DateTimeZone respectively. You can see the methods and constants available to the new classes by running'

    This class may need to be renamed.

    Cheers,

    Gary

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Installation Error: Cannot redeclare class Datetime Link to this post

    This would be why people complain about PHP's lack of namespace support ;-)

    I'll look at renaming this class; in the meantime are you able to use PHP 5.1?

  • gakenny
    Avatar
    Community Member
    153 Posts

    Re: Installation Error: Cannot redeclare class Datetime Link to this post

    Hi Sam,

    I just had my host install PHP5 and they installed the latest release. They'll slap me if I ask them to revert to the earlier version.

    I'll have to wait for the update - I can manually change the affected files myself if I knew what they were.

    Cheers,

    Gary

  • gakenny
    Avatar
    Community Member
    153 Posts

    Re: Installation Error: Cannot redeclare class Datetime Link to this post

    My host has rolled back to PHP 5.1.2 and set the memory limit in Apache and the script has now successfully installed.

    Now to some playing...

  • Matt
    Avatar
    Core Development Team
    84 Posts

    Re: Installation Error: Cannot redeclare class Datetime Link to this post

    We've renamed this class to SSDatetime in the latest release, due out shortly. The old Datetime class still exists, but is only defined if PHP doesn't already define it. That way, legacy code written for PHP 5.1 will still work if it used Datetime (however, it won't if the server is upgraded to 5.2 - you'll have to change to using SSDatetime for it to work then).

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