Opened 2 years ago

Closed 2 years ago

#3049 closed Task (fixed)

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

Reported by: cc Owned by:
Priority: low Milestone: 1.x - Piwik 1.x
Component: Core Keywords:
Cc: Sensitive: no

Description

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?

Change History (30)

comment:1 Changed 2 years ago by vipsoft (robocoder)

  • Cc cc removed
  • Milestone set to 1.7.x - Piwik 1.7.2
  • Resolution set to answered
  • Status changed from new to closed

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

http://dev.piwik.org/trac/export/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).

comment:2 Changed 2 years ago by cc

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 http://dev.piwik.org/svn/trunk/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

comment:3 follow-up: Changed 2 years ago by vipsoft (robocoder)

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

comment:4 in reply to: ↑ 3 Changed 2 years ago by cc

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 http://dev.piwik.org/trac/export/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

comment:5 follow-up: Changed 2 years ago by matt (mattab)

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?

comment:6 in reply to: ↑ 5 Changed 2 years ago by cc

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"?

comment:7 follow-up: Changed 2 years ago by matt (mattab)

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?

comment:8 in reply to: ↑ 7 Changed 2 years ago by cc

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?

comment:9 Changed 2 years ago by matt (mattab)

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

comment:10 follow-up: Changed 2 years ago by cc

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:

comment:11 follow-up: Changed 2 years ago by vipsoft (robocoder)

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();
}

comment:12 in reply to: ↑ 11 Changed 2 years ago by cc

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?

comment:13 follow-up: Changed 2 years ago by vipsoft (robocoder)

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?

comment:14 in reply to: ↑ 13 Changed 2 years ago by cc

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 } 

comment:15 Changed 2 years ago by cc

Opps, this is with the whitespace fixed:

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

comment:16 follow-up: Changed 2 years ago by vipsoft (robocoder)

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.

comment:17 in reply to: ↑ 16 ; follow-up: Changed 2 years ago by cc

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.

comment:18 in reply to: ↑ 17 ; follow-up: Changed 2 years ago by cc

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

comment:19 in reply to: ↑ 18 Changed 2 years ago by cc

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

comment:20 Changed 2 years ago by cc

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?

comment:21 in reply to: ↑ 10 Changed 2 years ago by cc

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.

comment:22 Changed 2 years ago by matt (mattab)

  • Milestone changed from 1.7.x - Piwik 1.7.2 to 1.x - Piwik 1.x
  • Priority changed from major to low

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!

comment:23 Changed 2 years ago by cc

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).

comment:24 Changed 2 years ago by vipsoft (robocoder)

  • Resolution answered deleted
  • Status changed from closed to reopened
  • Summary changed from Fatal error: Class 'Piwik_Db_Schema_Myisam' not found in core/Db/Schema.php on line 139 to Investigation: Fatal error: Class 'Piwik_Db_Schema_Myisam' not found in core/Db/Schema.php on line 139
  • Type changed from Bug to Task

comment:25 Changed 2 years ago by vipsoft (robocoder)

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

comment:26 Changed 2 years ago by cc

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

comment:27 Changed 2 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from reopened to closed

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

I'll update the FAQ and forum post.

comment:28 Changed 2 years ago by cc

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 :-)

comment:29 Changed 2 years ago by matt (mattab)

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:30 Changed 2 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.