Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've installed a plugin (HC custom WP-Admin url) locally and I didn't have any problems. I tried to install it on my server and I get the following error:

Fatal error: Cannot redeclare get_file_description() (previously declared in /home/USERNAME/public_html/wp-admin/includes/file.php:58) in /home/USERNAME/public_html/wp-admin/includes/file.php on line 71

Please note I DID post an error on that plugin's page. I'm posting again here because I suspect it isn't specific to that plugin, but rather a permission problem preventing the plugin from being installed properly. Has anybody had a similar problem?

The installation claims to be complete, but after the installation, the whole site breaks. I can't even logout. The only way i found to get the site running again is to rename the plugin folder. There's an error generated and WP deactivates the plugin and everything works again.

share|improve this question
    
The plugin installs and activates just fine on latest WP version and error message doesn't seem to be coming from its file. –  Rarst Sep 12 '13 at 13:31
    
Hey Rarst, thanks for your quick reply! I'm running the same version locally and on the server... –  RogerTheShrubber Sep 12 '13 at 13:37

1 Answer 1

up vote 0 down vote accepted

That plugin uses a really convoluted method to find & include file.php:

if (file_exists(dirname(__FILE__) . $DS . '..' . $DS . '..' . $DS . '..' . $DS . 'wp-admin' . $DS . 'includes' . $DS . 'file.php'))
    include(dirname(__FILE__) . $DS . '..' . $DS . '..' . $DS . '..' . $DS . 'wp-admin' . $DS . 'includes' . $DS . 'file.php');
else
  return; // if hierarchy is messed up, don't go further

My guess is that it considered your local environment to be "messed up" and didn't try to include() the file. The thing is, file.php isn't meant to be loaded on the fly like that, and you're seeing what happens when a plugin tries to load it after WordPress itself already has.

The plugin author should be checking if( !isset( $wp_file_descriptions ) ) before doing the include() or checking function_exists( 'get_home_path' ) which is the actual function they're trying to use from there. If one of those things exists, WordPress has already included the file and there's no need to do it again.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.