Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Investigation: Fatal error: Class 'Piwik_Db_Schema_Myisam' not found in core/Db/Schema.php on line 139 #3049

Closed
anonymous-piwik-user opened this Issue · 27 comments

3 participants

@anonymous-piwik-user

After upgrading to 1.7.1 most the piwik admin pages display this error:

Fatal error: Class 'Piwik_Db_Schema_Myisam' not found in (..)/piwik/core/Db/Schema.php on line 139

This has been raised on the forum here: http://forum.piwik.org/read.php?2,85650

Neither of the suggested solutions there worked, they are:

Are there any other suggestions regarding how to address this problem?

@robocoder
Collaborator

The missing file is core/Db/Schema/Myisam.php

https://github.com/piwik/piwik/blob/master/5924/trunk/core/Db/Schema/Myisam.php

I've confirmed that the file exists in the .zip file. Sounds like a problem when batch uploading the files from one's desktop (e.g., a file dropped by Filezilla).

@anonymous-piwik-user

Sorry I don't have permissions to reopen this ticket, but it does need to be reopened.

vipsoft said in #comment:1

I've confirmed that the file exists

I know that the file exists:

cd /web/stats.transitionnetwork.org/piwik/core/Db/Schema
ls 
 Myisam.php
md5sum Myisam.php 
 563d0e9e8c34ce2d472e216d72707a30  Myisam.php

I have also tried replacing it with the svn version as suggested on the forum http://forum.piwik.org/read.php?2,85650,page=1#msg-85657

cd /web/stats.transitionnetwork.org/piwik/core/Db
mv Schema Schema.bak
svn co https://github.com/piwik/piwik/blob/master/core/Db/Schema/
  A    Schema/Myisam.php
  Checked out revision 6045.
cd Schema
md5sum Myisam.php 
  763d3e6e117ab00a75ab17b9876fe9ba  Myisam.php
apache2ctl restart

And still the same error message all over the place:

Fatal error: Class 'Piwik_Db_Schema_Myisam' not found in /web/stats.transitionnetwork.org/piwik/core/Db/Schema.php on line 139 

The fact that the error reports that there is a problem with line 139 indicates to me that piwik is aware that the file exists?
This is line 139:

 idlogger_error INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,

Any suggestions about how I can fix this problem? I have also tried running the cron job to rebuild the graphs and also reinstalling APC, which was reported to fix the bug on the forum, see http://forum.piwik.org/read.php?2,85650,page=1#msg-87189

@robocoder
Collaborator

Please use the corrected link above. It should be rev 5924.

@anonymous-piwik-user

Replying to vipsoft:

Please use the corrected link above. It should be rev 5924.

I have done that:

cd /web/stats.transitionnetwork.org/piwik/core/Db/Schema
rm Myisam.php
wget https://github.com/piwik/piwik/blob/master/5924/trunk/core/Db/Schema/Myisam.php
apache2ctl restart
md5sum Myisam.php 
  444c7e17882f3b76038db72fd0b17d98  Myisam.php

And it hasn't made any difference, this error message appears all over the place in the piwik admin interface:

Fatal error: Class 'Piwik_Db_Schema_Myisam' not found in /web/stats.transitionnetwork.org/piwik/core/Db/Schema.php on line 139 

However the class is in the file, line 19:

grep -n "Piwik_Db_Schema_Myisam" Myisam.php 
19:class Piwik_Db_Schema_Myisam implements Piwik_Db_Schema_Interface

And this is line 139:

head -139 Myisam.php | tail -1
                                                                          idlogger_error INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,

Is there anything else I can try?

Thanks

@mattab
Owner

cc, not sure what the problem is in your case... appart from this error, is Piwik working or is it broken?

can you try a fresh 1.7.1 install? maybe some other files are corrupted. Or maybe there is some kind of auto loader bug on your config?

@anonymous-piwik-user

Replying to matt:

cc, not sure what the problem is in your case... appart from this error, is Piwik working or is it broken?

It's partially working, but the admin interface mostly displays this error, see the screenshot posted to the forums -- this is what I get also. I still don't think this ticket should be closed as this bug is not resolved.

http://forum.piwik.org/file.php?2,file=501

can you try a fresh 1.7.1 install? maybe some other files are corrupted. Or maybe there is some kind of auto loader bug on your config?

By a fresh install do you mean use the existing database with a new set of pwiki files? Because this is what I did...

If it helps at all I documented the upgrade here https://tech.transitionnetwork.org/trac/ticket/393 it was done initially on a development server, which didn't have this problem, and then on the live server and this is where the problem occurs.

How would I test to see if there is a "auto loader bug on your config"?

@mattab
Owner

on your live server, can you try reinstall piwik in a new DB, in a new directory, do you see the same bug? or have you really done that already?

@anonymous-piwik-user

Replying to matt:

on your live server, can you try reinstall piwik in a new DB, in a new directory, do you see the same bug? or have you really done that already?

The upgrade was done using a new directory in the same location (old one moved out of the way as a backup), but I kept the existing database and ran the database update on the command line.

I can do a totally fresh install, later today, and run it on another domain name with a new database but I'm not sure how this will help getting the existing site with the bug working properly?

@mattab
Owner

if your new install works, you can move the config.ini.php over to the new one, delete old one, move new one over old one

@anonymous-piwik-user

I have done a new install, in a new directory, with a new database, on a new domain name and I get the same error (I haven't copied across the old config file, a new one has been created):

Fatal error: Class 'Piwik_Db_Schema_Myisam' not found in /web/stats.transitionnetwork.org/piwik.1.7.1/core/Db/Schema.php on line 139 

Details of the new install here, https://tech.transitionnetwork.org/trac/ticket/393#comment:11

You can login yourself to see:

@robocoder
Collaborator

Maybe it's an APC+autoloader conflict?

Open core/Piwik/Db/Schema.php in an editor. At the end of the file, you should see the interface definition for Piwik_Db_Schema_Interface.

Try removing the interface from Schema.php, and creating a new file in core/Piwik/Db/Schema/Interface.php that contains:

<?php
/**
 * Database schema interface
 *
 * @package Piwik
 * @subpackage Piwik_Db
 */
interface Piwik_Db_Schema_Interface
{
        static public function isAvailable();

        public function getTableCreateSql($tableName);
        public function getTablesCreateSql();

        public function createDatabase( $dbName = null );
        public function dropDatabase();

        public function createTables();
        public function createAnonymousUser();
        public function truncateAllTables();
        public function dropTables( $doNotDelete = array() );

        public function getTablesNames();
        public function getTablesInstalled($forceReload = true);
        public function hasTables();
}
@anonymous-piwik-user

Thanks for looking at this problem.

Replying to vipsoft:

Maybe it's an APC+autoloader conflict?

Perhaps, the other person with this problem solved it with a APC reinstall, see http://forum.piwik.org/read.php?2,85650,page=1#msg-87189

Open core/Piwik/Db/Schema.php in an editor.

That file doesn't exist, but there is a
core/Db/Schema.php

At the end of the file, you should see the interface definition for Piwik_Db_Schema_Interface.

Yes.

Try removing the interface from Schema.php

I commented line 266 to the end.

and creating a new file in core/Piwik/Db/Schema/Interface.php

I created
core/Db/Schema/Interface.php
(as the
core/Piwik
directory doesn't exist) with the content suggested and restarted apache, these is still this error in the admin interface (login info in ticket:3049#comment:10 ):

Fatal error: Class 'Piwik_Db_Schema_Myisam' not found in /web/stats.transitionnetwork.org/piwik.1.7.1/core/Db/Schema.php on line 139 

Is there anything else I can try?

@robocoder
Collaborator

Sorry about the typo -- I was responding from my phone. =P Glad, you figured out the right paths.

In ./index.php, change these lines:

    $controller = Piwik_FrontController::getInstance();
    $controller->init();
    $controller->dispatch();

to:

    $controller = Piwik_FrontController::getInstance();
//  $controller->init();
//  $controller->dispatch();
    $class = 'Piwik_Db_Schema_Myisam';
    var_dump(new $class);

And reload the URL to your dashboard. What do you see?

@anonymous-piwik-user

Replying to vipsoft:

Sorry about the typo -- I was responding from my phone. =P

Ah, no worries, you must have a better phone than me, I gave up trying to use trac on mine after one attempt ;-)

I have made the changes and is is what is now displayed:

object(Piwik_Db_Schema_Myisam)#2 (1) { ["tablesInstalled":"Piwik_Db_Schema_Myisam":private]=> NULL } 
@anonymous-piwik-user

Opps, this is with the whitespace fixed:

object(Piwik_Db_Schema_Myisam)#2 (1) {
  ["tablesInstalled":"Piwik_Db_Schema_Myisam":private]=>
  NULL
}
@robocoder
Collaborator

Yes, it's a bit masochistic. Just because one can fork a github project, edit a file, and submit a pull request from one's phone, doesn't mean one should. ;)

But I digress. It's quite perplexing given that index.php is the central dispatcher that calls the front controller for all dashboard, widget, and API requests. I was hoping it would fail. I assume you're not using bootstrap.php to override PIWIK_INCLUDE_PATH.

If you can you email ssh login/password to us, we can take a look and try to diagnose the root cause.

@anonymous-piwik-user

Replying to vipsoft:

Yes, it's a bit masochistic. Just because one can fork a github project, edit a file, and submit a pull request from one's phone, doesn't mean one should. ;)

LOL

But I digress. It's quite perplexing given that index.php is the central dispatcher that calls the front controller for all dashboard, widget, and API requests. I was hoping it would fail. I assume you're not using bootstrap.php to override PIWIK_INCLUDE_PATH.

No, I have never touched that file.

If you can you email ssh login/password to us, we can take a look and try to diagnose the root cause.

That's OK with me but, I need to check with the client first, can you email a ssh public key to the email address at the bottom of this page: http://quince.transitionnetwork.org/ (the anti-spam features on this trac install mean that email addresses don't show up here).

Thanks a lot.

@anonymous-piwik-user

Replying to cc:

I need to check with the client first

The client is OK with this, it's a production server so I'm slightly nervous about it... can you either email me your pgp public key or a ssh public key so I can get it set up securely?

Thanks

Chris

@anonymous-piwik-user

Replying to vipsoft:

If you can you email ssh login/password to us, we can take a look and try to diagnose the root cause.

Replying to cc:

can you either email me your pgp public key or a ssh public key so I can get it set up securely?

I don't appear to have heard from you, is this offer to help still available? My email address is at the bottom of this page http://quince.transitionnetwork.org/

Thanks again

Chris

@anonymous-piwik-user

If you don't have time to look at the problem I'm having with Piwik could you at least reopen this ticket so others can see it's not solved in case someone else is able to help with it?

@anonymous-piwik-user

Replying to cc:

You can login yourself to see:

I have shut this test site down now as I don't think it's needed any more.

I'd still appreciate it if this ticket could be re-opened even if nobody has any time to look at this problem at the moment -- closed as "answered" is not an accurate state -- the problem is ongoing and the pikwi install at stats.transitionnetwork.org still has an unusable web interface.

@mattab
Owner

Sorry you still have the problem. I must say we are too busy to help at this stage apparently, but if more users experience this ticket or if we have less work in the future we will look into. Thanks!

@anonymous-piwik-user

On ticket:3092#comment:1 matt agreed that this ticked should be reopened, could that now be done as this problem isn't resolved.

I appreciate that you don't consider this to be a Piwik problem but there clearly is a problem with the Piwik install I have running even if the problem is with the way that the environment is configured (it was suggested that the problem could be with APC).

@robocoder
Collaborator

I have emailed chris my ssh public key and re-opened for investigation.

@anonymous-piwik-user

Nice one, I see you have got in, thanks a lot for looking at this :-)

@robocoder
Collaborator

Resolved; turning off apc.include_once_override (experimental) and setting apc.mmap_file_mask = /dev/zero

I'll update the FAQ and forum post.

@anonymous-piwik-user

Thank a lot for looking at this, the problem was with APC, specifically these two settings in
/etc/php5/apache2/conf.d/apc.ini
:

apc.include_once_override = 1
apc.mmap_file_mask = /tmp/apc.XXXXXX

When these were changed to:

apc.include_once_override = 0
apc.mmap_file_mask = /dev/zero

The problems were fixed :-)

@anonymous-piwik-user anonymous-piwik-user added this to the 1.x - Piwik 1.x milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.