When I upgrade or install WP Statistics 11.0 I get an error message like “Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in…”

Since WP Statistics 11.0, PHP 5.4 or above has been required. If you are using an older version of PHP it cannot understand the new syntax included in WP Statistics 11.0 and generates a parse error.

Your hosting provider should have a newer version of PHP available, sometimes you must activate it through your hosting control panel.

Since the last release of PHP 5.3 is over 2 years ago (Aug 2014) and is no longer supported or receiving security fixes, if your provider does not support a newer version you should probably be moving hosting providers.

If you have done an upgrade and you can no longer access your site due to the parse error you will have to manually delete the wp-statistics directory from your wordpress/wp-content/plugins directory, either through your hosting providers control panel or FTP.

You may also downgrade to WP Statistics 10.3 as a temporary measure, but no new fixes or features will be added to that version and you should move to a newer version of PHP as soon as possible. You can download the 10.3 here.

I see error messages in my PHP log like “WordPress database error Duplicate entry ‘YYYY-MM-DD’ for key ‘unique_date’ for …”

This is caused by a race condition in the code, it’s safe to ignore (it shouldn’t be labeled as an error really, but that is part of WordPress that we can’t control).

It happens when a new day starts and two visitors hit the site at nearly the same time for the first visit of the day. Both try and create a new row in the table to track the days visits, but only one of them success and the other throws this warning.

My overview screen is blank, what’s wrong?

This is usually caused by a PHP fatal error, check the page source and PHP logs.

The most common fatal error is an out of memory error. Check the Statistics->Optimization page and see how much memory is currently assigned to PHP and how much the overview is using.

If it is a memory issue you have two choices:

  • Increase PHP’s memory allocation
  • Delete some of your historical data.

See http://php.net/manual/en/ini.core.php#ini.memory-limitp for information about PHP’s memory limit.

To remove historical data you can use the Statistics -> Optimization -> Purging -> Purge records older than.

Subscribe Newsletter

Sign up with your email address to receive news and updates.