query-monitor icon indicating copy to clipboard operation
query-monitor copied to clipboard

PHP Fatal error: Cannot declare class QM_PHP, because the name is already in use

Open SannhetJaeger opened this issue 3 years ago • 4 comments

E_COMPILE_ERROR was caused in line 8 of the file [...path...]/wp-content/plugins/query-monitor/classes/PHP.php

I searched for this and found the same item closed 4 days ago. Uninstalled and reinstalled to see if that solved it - no. Per the other issue, I can confirm that the [...path...]/wp-content/db.php symlink is pointing correctly to [...path...]/wp-content/plugins/query-monitor/wp-content/db.php.

In my case, I do in fact utilize Wordpress Toolkit for cloning to subdomains and I noted the symlink clones referring back to original site. It would be wonderful if this was clone friendly, but that's not the end of things since generally I delete plugin within production; so not a normal flow. Have another site on same server I clone and Query Monitor is happily working. Versions are identical in both sites, though different plugin combinations.

For what it's worth, here's a grep of QM_PHP in that sites root (in case that helps identify something residual?):

grep -R QM_PHP ./* ./wp-content/db.php:if ( ! QM_PHP::version_met() ) { ./wp-content/plugins/query-monitor/query-monitor.php:if ( ! QM_PHP::version_met() ) { ./wp-content/plugins/query-monitor/query-monitor.php: add_action( 'admin_notices', 'QM_PHP::php_version_nope' ); ./wp-content/plugins/query-monitor/wp-content/db.php:if ( ! QM_PHP::version_met() ) { ./wp-content/plugins/query-monitor/classes/Activation.php: if ( ! QM_PHP::version_met() ) { ./wp-content/plugins/query-monitor/classes/Activation.php: QM_PHP::$minimum_version, ./wp-content/plugins/query-monitor/classes/PHP.php:abstract class QM_PHP {

SannhetJaeger avatar Feb 20 '22 00:02 SannhetJaeger

I've got to the same issue... is there any solution to solve this?

Here's my grep-result:

$ grep -R QM_PHP ./*
./wp-content/plugins/query-monitor/classes/Activation.php:              if ( ! QM_PHP::version_met() ) {
./wp-content/plugins/query-monitor/classes/Activation.php:                                      QM_PHP::$minimum_version,
./wp-content/plugins/query-monitor/classes/PHP.php:class QM_PHP {
./wp-content/plugins/query-monitor/wp-content/db.php:if ( ! QM_PHP::version_met() ) {
./wp-content/plugins/query-monitor/query-monitor.php:if ( ! QM_PHP::version_met() ) {
./wp-content/plugins/query-monitor/query-monitor.php:   add_action( 'admin_notices', 'QM_PHP::php_version_nope' );
./wp-content/db.php:if ( ! QM_PHP::version_met() ) {

hosa8113 avatar Jun 24 '22 08:06 hosa8113

Try to delete db.php in your wp-content dir, worked for me.

jmslbam avatar Jul 05 '22 19:07 jmslbam

Try to delete db.php in your wp-content dir, worked for me. @jmslbam Didn't work for me.

rao-manoj avatar Jul 07 '22 05:07 rao-manoj

Some issues may be solved by adjusting the symlink to use a relative path, instead of an absolute path.

See #247.

crstauf avatar Jul 07 '22 22:07 crstauf

Thank you @jmslbam - worked :-)

PunchcardCoder avatar Sep 06 '22 09:09 PunchcardCoder