Fatal Error on Activation – Windows 7 and PHP 5.2
-
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:
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!
- The topic ‘Fatal Error on Activation – Windows 7 and PHP 5.2’ is closed to new replies.