Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7950573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:18:58+00:00 2026-06-04T02:18:58+00:00

I recently moved website to a new host. The server setup is very similar.

  • 0

I recently moved website to a new host. The server setup is very similar. I used easy apache to duplicate the configuration on the new server.

However, the same zend framework web application that ran just fine on previous server has this date issue on the new server.

Whether using either of these, the date inserted into mysql datetime column is incorrect.

$row->creation_date = date('Y-m-d H:i:s');

$row->creation_date = date('Y-m-d H:i:s', TRUE);

The value in the datetime column is 0000-00-00 00:00:00

If I change the datatype in mysql to like varchar, the value is 2012

If I add a line right under the $row calls, mail(), to email me the value of date(), I get the correct time stamp.

If I concat the date() value to another value which is stored in a different column same row, I get 1970-01-01 00:00:01

I’m stumped!

Any suggestions?

EDIT

No changes in code were made between the move from old to new server.

OLD SERVER
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with the ionCube PHP Loader v4.0.9, Copyright (c) 2002-2011, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

NEW SERVER
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with the ionCube PHP Loader v4.0.9, Copyright (c) 2002-2011, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

WHM 11.30.5

CENTOS 6.2 x86_64

PHP 5.3.8

MYSQL 5.0.92

Zend Framework const VERSION = ‘1.9.5’;

Issue description in short:
While php date() provides the correct date value, the zend framework changes the value to just year before attempting to insert into a mysql datetime field. I believe something is causing zend to change the date value before the insert, but can’t find what.

public function addComment(Core_Model_Item_Abstract $resource, Core_Model_Item_Abstract $poster, $body)
{
$table = $this->getCommentTable();
$row = $table->createRow();

if( isset($row->resource_type) )
{
  $row->resource_type = $resource->getType();
}

$row->resource_id = $resource->getIdentity();
$row->poster_type = $poster->getType();
$row->poster_id = $poster->getIdentity();

$row->creation_date = date('Y-m-d H:i:s'); // this date() is throughout app
//if I put mail(send me date('Y-m-d H:i:s') I got correct time stamp)
$row->body = $body;
$row->save();

if( isset($resource->comment_count) )
{
  $resource->comment_count++;
  $resource->save();
}

return $row;
}

The MYSQL table:

CREATE TABLE `comments` (
`comment_id` int(11) unsigned NOT NULL auto_increment,
`resource_id` int(11) unsigned NOT NULL,
`poster_type` varchar(24) character set latin1 collate latin1_general_ci NOT NULL,
`poster_id` int(11) unsigned NOT NULL,
`body` text collate utf8_unicode_ci NOT NULL,
`creation_date` datetime NOT NULL,
`like_count` int(11) unsigned NOT NULL default '0',
PRIMARY KEY  (`comment_id`),
KEY `resource_type` (`resource_id`),
KEY `poster_type` (`poster_type`,`poster_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:18:59+00:00Added an answer on June 4, 2026 at 2:18 am

    I fixed this issue replacing the PHP date() function with:

    new Zend_Db_Expr('NOW()');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've recently moved our company website to a new host. It is an ASP.NET
I recently moved my main website into a new folder: The websites was in
I recently moved my redmine installation to a new server and for some reason
I have recently moved my VisualSVN Server 2.5.2 to a new machine(from Windows Server
I recently moved to Visual Studio 2010 and upgraded my website to work with
I recently moved a friends blog onto his new web hosts but unfortunately the
I recently moved my WordPress website to a subfolder. I want to add a
I recently transitioned my companies website over to our in-house servers (Apache) from a
I have recently purchased some new windows server 2008 boxes all running IIS7. I
I recently moved my projects to a new mac, along with a newer version

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.