• Resolved David Lingren

    (@dglingren)


    I had a frustrating time getting Query Monitor working on my system, and a couple of small changes would have helped a lot.

    The QueryMonitor::activate function runs on plugin activation (register_activation_hook( __FILE__, array( $this, 'activate' ) );). This function makes a silent call to the PHP symlink function (@symlink( $this->plugin_path( 'wp-content/db.php' ), $db );). The function does not exist for Windows PHP versions prior to 5.3, so the call generates a fatal error (Fatal error: Call to undefined function symlink()).

    The error message is not displayed because of the “@symlink” call, but activation fails anyway. WordPress reports this, but with no visible indication of why the activation failed. It would be easy to either remove the “@” so the error is displayed or use the PHP function_exists() function to handle this error more reasonably.

    I finally found this WIKI post on GitHub:

    db.php Symlink

    Sadly, the order of the “mklink” arguments for the Windows fix is reversed, and so does not work. The syntax is:

    MKLINK [[/D] | [/H] | [/J]] Link Target

    i.e.,

    mklink C:\path\to\wordpress\wp-content\db.php C:\path\to\wordpress\wp-content\plugins\query-monitor\wp-content\db.php

    Improving the activation process and fixing the GitHub page would help a lot. Thanks for a terrific plugin and a valuable tool!

    https://www.ads-software.com/plugins/query-monitor/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Thanks for the report David! Sounds like I got in a bit of a muddle with those symlinks. The plugin did previously check for function_exists() before calling symlink() but I removed it recently. Clearly it needs to stay.

    The reason the @ suppressor is in place is because the symlink isn’t essential and I didn’t want to trigger warning on activation if the directory wasn’t writable etc.

    I’ll get the plugin and the wiki sorted out!

    Thread Starter David Lingren

    (@dglingren)

    Thank you for the instant and positive response.

    I should add that the Windows “MKLINK” requires administrator privileges, so the Command Prompt window should be opened by right-clicking and selecting “Run as administrator”.

    Even after manually creating the symlink, I am getting this message in the $wpdb Queries portion of the Query Monitor display:

    “Extended query information such as the component and affected rows is not available. Query Monitor was unable to symlink its db.php file into place.”

    I have not been able to determine why it’s not working completely.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Which version of Windows are you running?

    Thread Starter David Lingren

    (@dglingren)

    I am running Windows 7 Professional.

    I went ahead and upgraded to PHP 5.3.26. When I first re-visited WordPress I still got the above message.

    I de-activated and re-activated Query Monitor. The fatal activation error did not occur (as expected) and now the “unable to symlink” message has gone away as well.

    I suspect there’s something about the manual workaround that’s not quite right, but now I’ve upgraded and the PHP 5.3 support is fine.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    This has been fixed in the develop branch of QM on GitHub, by the way. It’ll be released in the next version.

    Thread Starter David Lingren

    (@dglingren)

    Thanks for the update and the good news. I’ve been using the plugin every day since I got it working and it’s really helpful. Excellent work!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal Error on Activation – Windows 7 and PHP 5.2’ is closed to new replies.