Automatic Installation attempt when Piwik is already installed

I’m having an issue with an existing Piwik install after reinstalling Nginx. After reinstalling Nginx, moving all the files back into place and browsing to our Piwik install I am presented with the message: “Error: Piwik is already installed”.

Walking through the code it seems to be getting hung up in the plugins/Installation/Controller.php file during the welcome() function when it does a call to $this->checkPiwikIsNotInstalled() at which point it returns the above message and exits.

What I’m hoping someone may be able to shed some light on is what is the insertion point to start trying to do the install process? I suspect I must have removed a file somewhere along the line, but I really don’t want to reset the config and DB table if possible.

I ended up being able to track down the underlying reason by adding a debug_backtrace in the function welcome() within plugin/Installation/Controller.php.

This is what showed up in the backtrace: string(62) “Mysqli prepare error: Table ‘piwik.piwik_option’ doesn’t exist”

Somewhere along the line the database became inconsistent between MySQL nodes. So this ended up being displayed intermittently depending which DB backend you hit.

I had a similar issue after migrating servers. Mine was fixed by downloading the latest piwik and copying the config.ini.php file from the old installation. It said I needed to update my database, which I did, and all works great now!

Good luck.