Title: fatal error
Last modified: August 21, 2016

---

# fatal error

 *  Resolved [wji](https://wordpress.org/support/users/wji/)
 * (@wji)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/fatal-error-1136/)
 * HI,
 * superb plugin.
    Often,after migrating a site plugin gives an error an needs to
   be disabled by ftp to get the migrated site running.
 * Then I remove the allready disabled plugin and want to install it again, I get
   this:
    Fatal error: Cannot redeclare class QM_Backtrace in /home/*************/
   wp-content/plugins/query-monitor/Backtrace.php on line 17
 * Happened with several sites. Any suggestions?
 * Thanks!
 * [https://wordpress.org/plugins/query-monitor/](https://wordpress.org/plugins/query-monitor/)

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [12 years, 2 months ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794554)
 * Hi wji,
 * Are you running the latest version of QM on these sites? This issue should be
   fixed in the current version.
 *  Thread Starter [wji](https://wordpress.org/support/users/wji/)
 * (@wji)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794560)
 * Hi John,
    thank you for getting in touch. I am running 2.6.6, WordPress 3.8.2(
   also in 3.8.1 same error). w.
 * A clue could be that it is migration related. I I install your plugin on a fresh
   install it works fine. After a move it won’t work. Maybe a databse clean of your
   plugin after the movement would do the trick? Site is properly migrated and database
   urls are securly updated, only plugin that gives problems seems to be this one
   each time.
 * If you want more information about server, php versions etc, please let me know!
 *  Thread Starter [wji](https://wordpress.org/support/users/wji/)
 * (@wji)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794716)
 * Dear John,
    any updates on this? Error seems persistent with moving installs.
 * Regards,
 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794793)
 * Hi wji,
 * > Often,after migrating a site plugin gives an error an needs to be disabled 
   > by ftp to get the migrated site running.
 * What’s the error that you get here? Is it the “Cannot redeclare class QM_Backtrace”
   error? Or is it different?
 *  Thread Starter [wji](https://wordpress.org/support/users/wji/)
 * (@wji)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794794)
 * Hi John,
    yes, this is it, error is there also when deinstalling etc.:
 * Fatal error: Cannot redeclare class QM_Backtrace in /…/wp-content/plugins/query-
   monitor/Backtrace.php on line 17
    Tried a lot to get it running again, but none.
 * Happened several times again with new (totally different site) migratings too
   in last weeks.
 * Is there a way to totally clean the plugin from the database maybe so we can 
   narrow things here?
 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794795)
 * > Is there a way to totally clean the plugin from the database maybe so we can
   > narrow things here?
 * The plugin adds nothing to the database, so there’s nothing to clear out. The
   only thing affected in the database when Query Monitor is active is the `active_plugins`
   option (or `active_sitewide_plugins` option).
 * Which hosting are you on?
    Which other plugins are active? Do you have any persistent
   caching in place such as Memcached or Opcache? How are you migrating your sites?
 *  [ipstas](https://wordpress.org/support/users/ipstas/)
 * (@ipstas)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794797)
 * John,
 * Same story. I had to restore site from different copy, QM can not be activated
   because of the same error Cannot redeclare class QM_Backtrace
 * Tried to delete it and install again, did not help
 * Then figured out – I was backing up to windows box, symlink was lost and for 
   some reason was not recreated while installing. So, I have just created symlink
   manually
    wp-content# ln -s plugins/query-monitor/wp-content/db.php . Now it 
   works
 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794799)
 * Interesting. I can’t see why that would cause the QM_Backtrace class to be redeclared.
   Possibly something else odd going on there.
 *  [James Kraus](https://wordpress.org/support/users/james-kraus/)
 * (@james-kraus)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794812)
 * [@john](https://wordpress.org/support/users/john/)
 * I’m recieving this related message:
 * > Notice: Undefined offset: 0 in /var/www/wp-content/plugins/query-monitor/Backtrace.
   > php on line 155
   > Notice: Undefined index: line in /var/www/wp-content/plugins/query-monitor/
   > Backtrace.php on line 158
 * Which seems related to this block:
 *     ```
       if ( empty( $trace ) ) {
       				$lowest                 = $this->trace[0];
       				$file                   = QM_Util::standard_dir( $lowest['file'], '' );
       				$lowest['calling_file'] = $lowest['file'];
       				$lowest['calling_line'] = $lowest['line'];
       				$lowest['function']     = $file;
       				$lowest['display']      = $file;
       				$lowest['id']           = $file;
       				unset( $lowest['class'], $lowest['args'], $lowest['type'] );
       				$trace[0] = $lowest;
       			}
       ```
   
 * It seems that if the array is empty, then it shouldn’t have value with a key 
   of 0.
 *  Thread Starter [wji](https://wordpress.org/support/users/wji/)
 * (@wji)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794814)
 * This is what was causing the issue,
    Ipstas’s brilliant remark:
 * > Then figured out – I was backing up to windows box, symlink was lost and for
   > some reason was not recreated while installing. So, I have just created symlink
   > manually
   >  wp-content# ln -s plugins/query-monitor/wp-content/db.php . Now it
   > works
 * The symlink path is copied with a migration, but not changed to the new path,
   plugins keeps using the old symlink path.
 * John, any way you can fix this in an upgrade?
 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794815)
 * Unfortunately this is a filesystem-level issue. If you move a website (or in 
   fact, any files on any computer) from one place to another, you should update
   any symlinks which are present within the files you’re moving.
 * It would be an unnecessary overhead to try to address this edge case within Query
   Monitor itself.
 * If you’re using a plugin or other script for migrating your site, you could update
   it to recursively look for any symlinks and correct them after the migration.
 *  Thread Starter [wji](https://wordpress.org/support/users/wji/)
 * (@wji)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794816)
 * hi John,
    it happens when backing up to windows box, Backupbuddy and also with
   provider-staging-testing environments , so it is not related to one special migrating
   script only. Are you sure that it is not a Query Monitor issue since problem 
   is only there with QM?
 * Thanks!
 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794817)
 * Yes the problem likely only affects QM because I doubt many other plugins put
   symlinks into place, but if another plugin put a symlink into place, or something
   else on your filesystem used symlinks, then you would have the same issue. The
   issue is at the filesystem level, and it’s impractical to attempt to address 
   it in each individual plugin.
 *  Thread Starter [wji](https://wordpress.org/support/users/wji/)
 * (@wji)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794818)
 * Hi John,
 * I got feedback from Ithemes (from the migration plugin Backupbuddy) about this
   problem.
    I think it is interesting information to address the issue.
 * I quote from Ithemes support:
 * >  The symlink _should_ be defined as relative rather than absolute – the _relationship_
   > between the source and target will not change when the site is moved (migrated)
   > so there is no problem. Currently the symlink is defined as an absolute path
   > and this is what causes the problem. This is the _best_ solution for _users_
   > of the plugin and would be very simply implemented by the plugin author.
 * …
 * > let’s suppose a scripts did search every file just to check for any symlink
   > that needed to be changed to something – not all hosts allow the use of the
   > symlink() function to define symlinks and so this simply wouldn’t be possible(
   > the qm plugin itself acknowledges this because it checks whether the symlink()
   > function is available and doesn’t provide this particular functionality if 
   > it is not). So if the migration couldn’t update the symlink() what does it 
   > do? It might tell you it finds an invalid symlink that cannot be updated
 * John, is it possible to adjust this in a future update? Especially for a debugging
   plugin like QM portability is very much appreciated for a great plugin like QM.
   
   Let me know what you think.
 * Regards,
 *  [ipstas](https://wordpress.org/support/users/ipstas/)
 * (@ipstas)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794842)
 * I have a confirmation now why it happened for me.
 * Same story – I have copied the site over, renamed the folder, changed the database,
   got the Cannot redeclare class QM_Backtrace .
 * So I checked the symlink for db.php, it was pointing to the old install. Deleted
   it and recreated it with
    wp-content# ln -s plugins/query-monitor/wp-content/
   db.php .
 * It worked like a charm.
    My advice: do not create symlink with the full path,
   just create it starting with wp-content or plugins.
 * And thanks for the perfect plugin!

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘fatal error’ is closed to new replies.

 * ![](https://ps.w.org/query-monitor/assets/icon.svg?rev=2994095)
 * [Query Monitor](https://wordpress.org/plugins/query-monitor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/query-monitor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/query-monitor/)
 * [Active Topics](https://wordpress.org/support/plugin/query-monitor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/query-monitor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/query-monitor/reviews/)

 * 15 replies
 * 4 participants
 * Last reply from: [ipstas](https://wordpress.org/support/users/ipstas/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-1136/#post-4794842)
 * Status: resolved