Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anonymous-matomo-user opened this issue Mar 14, 2012 · 27 comments
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@anonymous-matomo-user
Copy link

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
Copy link
Contributor

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-matomo-user
Copy link
Author

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
Copy link
Contributor

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

@anonymous-matomo-user
Copy link
Author

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
Copy link
Member

mattab commented Mar 19, 2012

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-matomo-user
Copy link
Author

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
Copy link
Member

mattab commented Mar 21, 2012

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-matomo-user
Copy link
Author

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
Copy link
Member

mattab commented Mar 21, 2012

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-matomo-user
Copy link
Author

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
Copy link
Contributor

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-matomo-user
Copy link
Author

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
Copy link
Contributor

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-matomo-user
Copy link
Author

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-matomo-user
Copy link
Author

Opps, this is with the whitespace fixed:

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

@robocoder
Copy link
Contributor

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-matomo-user
Copy link
Author

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-matomo-user
Copy link
Author

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-matomo-user
Copy link
Author

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-matomo-user
Copy link
Author

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-matomo-user
Copy link
Author

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
Copy link
Member

mattab commented Apr 6, 2012

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-matomo-user
Copy link
Author

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
Copy link
Contributor

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

@anonymous-matomo-user
Copy link
Author

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

@robocoder
Copy link
Contributor

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-matomo-user
Copy link
Author

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-matomo-user anonymous-matomo-user added this to the 1.x - Piwik 1.x milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

3 participants