Undefined index: ts_created

I installed Piwik in early November and had no problems with it. Recently our web host updated to PHP Version 5.2.12, and now Piwik is not working. I can’t tell you which version of Piwik we have because the pages won’t generate properly so I can see the version information in the meta tag. Here is the error I’m receiving. Thank you in advance for any help.

Notice: Undefined index: ts_created in /users2/data/v/veinforu-02701/public_html/piwik/core/Site.php on line 54

Backtrace -->
#0 Piwik_ErrorHandler(8, Undefined index: ts_created, /users2/data/v/veinforu-02701/public_html/piwik/core/Site.php, 54, Array ()) called at [/users2/data/v/veinforu-02701/public_html/piwik/core/Site.php:54]
#1 Piwik_Site->getCreationDate() called at [/users2/data/v/veinforu-02701/public_html/piwik/core/Controller.php:298]
#2 Piwik_Controller->redirectToIndex(CoreHome, index) called at [/users2/data/v/veinforu-02701/public_html/piwik/plugins/CoreHome/Controller.php:32]
#3 Piwik_CoreHome_Controller->redirectToCoreHomeIndex() called at [(null):0]
#4 call_user_func_array(Array ([0] => Piwik_CoreHome_Controller Object ([] => CoreHome,[] => 2010-01-19,[] => Piwik_Date Object ([] => 1263888000),[] => Array ([label] => General_ColumnLabel,[nb_visits] => General_ColumnNbVisits,[nb_actions] => General_ColumnNbActions,[max_actions] => General_ColumnMaxActions,[sum_visit_length] => General_ColumnSumVisitLength,[nb_uniq_visitors] => General_ColumnNbUniqVisitors,[nb_actions_per_visit] => General_ColumnActionsPerVisit,[avg_time_on_site] => General_ColumnAvgTimeOnSite,[bounce_rate] => General_ColumnBounceRate,[revenue_per_visit] => General_ColumnValuePerVisit,[goals_conversion_rate] => General_ColumnVisitsWithConversions)),[1] => redirectToCoreHomeIndex), Array ()) called at [/users2/data/v/veinforu-02701/public_html/piwik/core/FrontController.php:129]
#5 Piwik_FrontController->dispatch() called at [/users2/data/v/veinforu-02701/public_html/piwik/index.php:91]

Date format must be: YYYY-MM-DD, or ‘today’ or ‘yesterday’ or any keyword supported by the strtotime function (see php.net/strtotime for more information)

You’ll have to manually update Piwik. I didn’t see that error with 0.5.4 with php 5.2.12.

Thank you for responding. I’ve manually upgraded to 0.5.4 and am still having this problem. The web host recently upgraded to that version of PHP. Is there some sort of timestamp setting within a PHP install that could be causing problems? Thank you.

You might have to run the unit tests (found in Piwik’s svn repository). The only thing that comes to mind is the buggy date changes in php 5.3 that affected users on 64-bit machines.

I have now executed all of the tests, and they all passed. There were no fails or exceptions. I was particularly interested in the results from Date.test and PHP_Related.test, and they passed. I’m not sure where to go from here. Is anyone else successfully running Piwik 0.5.4 with PHP 5.2.12? My web host believes that those versions of Piwik and PHP are not compatible. I’m not claiming it’s anyone’s fault - I just want to get it working for my client! Thank you.

Can you run this query (using the appropriate prefix, if not ‘piwik_’) on the database?

SELECT * FROM piwik_site;

[quote=vipsoft @ Jan 22 2010, 06:23 AM]Can you run this query (using the appropriate prefix, if not ‘piwik_’) on the database?

SELECT * FROM piwik_site;

[/quote]

idsite name main_url ts_created feedburnerName
1 American Venous Forum veinforum.org 2009-11-01 17:40:57 NULL

(The actual main url includes http:// but the comment system wouldn’t let me write that.)

Thanks!

Hmm… ts_created has a value in the table, but it isn’t being returned to Piwik in its query?

Did your site also make changes to its MySQL configuration?

[quote=vipsoft @ Jan 22 2010, 03:11 PM]Hmm… ts_created has a value in the table, but it isn’t being returned to Piwik in its query?

Did your site also make changes to its MySQL configuration?[/quote]

Yes, I had checked into that table when I investigated the code in Site.php and saw the query. Seems like something strange going on with the format of the date. I will look into if a MySQL config update may have occurred recently with the web host.

I do get this message when I log in to phpMyAdmin: “Your PHP MySQL library version 5.0.84 differs from your MySQL server version 5.1.38. This may cause unpredictable behavior.” I think I may mention that to the web host, also.

[quote=donia @ Jan 22 2010, 05:46 PM]Yes, I had checked into that table when I investigated the code in Site.php and saw the query. Seems like something strange going on with the format of the date. I will look into if a MySQL config update may have occurred recently with the web host.

I do get this message when I log in to phpMyAdmin: “Your PHP MySQL library version 5.0.84 differs from your MySQL server version 5.1.38. This may cause unpredictable behavior.” I think I may mention that to the web host, also.[/quote]

Web host says that MySQL has not been updated recently, and the warning message is no big deal. Thanks for sticking with me this far. I just don’t know how I’m going to get this running again?

very strange…
can you try a var_dump(self::$infoSites) in core\Site.php line 54? what does it output to screen?

[quote=matthieu @ Jan 26 2010, 04:08 PM]very strange…
can you try a var_dump(self::$infoSites) in core\Site.php line 54? what does it output to screen?[/quote]

Here is what I get:

array(1) { [1]=> array(4) { [“idsite”]=> string(1) “1” [“name”]=> string(21) “American Venous Forum” [“piwik_site”]=> string(19) “2009-11-01 17:40:57” [“doctorinfo2”]=> NULL } }

Thank you!

Which db adapter are you using? You might try switching between MYSQLI and PDO_MYSQL in config/config.ini.php.

Phpinfo shows PDO driver information. When I switched to MYSQLI, it gave me this message: The “Mysqli extension is required for this adapter but the extension is not loaded”, so it must be PDO_MYSQL.

Are there other PHP parameters I should be looking at?

Thank you.

the notices are a php feature to mark deprecated features like accessing undefined array indexes, variables and things like that. This way previously “BASIC-like” so that these errors were silently ignored and this is now being slowly shifted to a more thorough verification. Starting with a recent php version, the notices are displayed by default if this is not turned off in php.ini, short of fixing the php code, you can change the php variable from

error_reporting = E_ALL to error_reporting = E_ALL & ~ E_NOTICE

in the long run, everybody will have to fix their code, there shouldn’t be any notices left of course.

[quote=AlexLehm @ Jan 26 2010, 11:07 PM]the notices are a php feature to mark deprecated features like accessing undefined array indexes, variables and things like that. This way previously “BASIC-like” so that these errors were silently ignored and this is now being slowly shifted to a more thorough verification. Starting with a recent php version, the notices are displayed by default if this is not turned off in php.ini, short of fixing the php code, you can change the php variable from

error_reporting = E_ALL to error_reporting = E_ALL & ~ E_NOTICE

in the long run, everybody will have to fix their code, there shouldn’t be any notices left of course.[/quote]

Which notices are you referring to? The notice in phpmyadmin that I referenced, the original problem I’m having, or the notice about MYSQLI?

Thanks.

[quote=donia @ Jan 27 2010, 12:16 AM]Which notices are you referring to? The notice in phpmyadmin that I referenced, the original problem I’m having, or the notice about MYSQLI?

Thanks.[/quote]
the original problem, php notice

Notice: Undefined index: ts_created in /users2/data/v/veinforu-02701/public_html/piwik/core/Site.php on line 54