Support » Fixing WordPress » wp-stats plugin v. 1.2 Fatal error stats.php on line 548

  • Resolved raymer


    I’m getting an error on my dashboard using wp-stats plugin version 1.2 on new wp 2.5. The double wide widget shows the graph on the left just fine but does not show the top posts on the right – only the followin error:
    Fatal error: Only variables can be passed by reference … in <path>stats.php on line 548

    I checked my install (I use svn). I even deleted the wp-includes and wp-admin dirs and redownloaded the files. Didn’t help. I have another site on the same webhost and the plugin works fine so I don’t think its a PHP version thing – weird I can’t figure it out.

    Any ideas?


Viewing 11 replies - 1 through 11 (of 11 total)
  • me too

    Hi, i looked at the code, and this could happen when you have a corrupted stats cache.
    To fix it you have to manually execute (via phpMyAdmin or similar) this query, in your WordPress database:
    DELETE FROM wp_options WHERE option_name = 'stats_cache'

    Next time you reload the page, the cache will be re-created and it should work as expected.

    Bingo! That worked. Thanks a lot.

    Can you bring this to the developers’ attention? Any way they could make the plugin more robust in this regard?


    I mailed the authors about this, and proposed a fix to avoid this issue.

    A little further information — after a few days I went into the plugin options and changed the stats options from days to months to weeks etc. Trying to see which options were best and bam! the same error appeared. So somehow changing the options on the plugin has caused database corruption??? Will your proposed fix help that?


    Yes, it should, because it erases the cache whenever it is invalid.
    The fix is this:
    Edit the file stats.php, and change line 543:

    if ( !$stats_cache = get_option( 'stats_cache' ) )
          $stats_cache = array();


    $stats_cache = get_option( 'stats_cache' );
        if ( !$stats_cache || !is_array( $stats_cache ) )
          $stats_cache = array();

    Thanks. That seems to have done the trick. I appreciate your help!

    FWIW, I suspect that what is causing problems is the data which is retrieved to fill in the section titled “Top Searches.” This is a Japanese website and one of the strings in that section is munged. I think it is in a codepage other than UTF-8 and that’s what’s messing things up.

    I have he same problem with my catche.

    I just downloaded phpMyAdmin after fresten wrote about it. I hve never used i before and I just wounder what more than that “DELETE FROM wp_options WHERE option_name = ‘stats_cache'” line I have to write down. It says that I need to choose a colum but I cant find any to choose from.

    please look at this pickture and see what I missed to fill in.

    I hope you can help me,


    Hello Frasten,

    I run manually on phpmyadmin the code (DELETE FROM wp_options WHERE option_name = ‘stats_cache’), and that worked perfect.

    Thx a lot !!

    I think I need “phpMyAdmin for dummies” . I have try to find where to put the line ” DELETE FROM wp_options WHERE option_name = ‘stats_cache’ “.

    Hi 🙂

    – Log into your phpMyAdmin page
    – select your database from the dropdown menu on your left
    – click on the SQL tab on the top of the page
    – paste the query
    – click on Execute
    – Enjoy!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘wp-stats plugin v. 1.2 Fatal error stats.php on line 548’ is closed to new replies.