Fixing that ‘Plugin could not be activated because it triggered a fatal error.’ problem with wordpress plugins

The huge range of useful plug-ins for WordPress are a contributing factor to its huge popularity both as a blogging platform and as a content management system. The great thing about the plugin system is that – in theory at least – it’s dead simple to setup. You upload the plugin to your plugins directory, then go into the wordpress admin area and activate it. Any special instructions will then appear from the plugin itself.

Of course life isn’t always that simple. A client called early this morning saying that he was having problems installing a new plugin (the mailchimp wordpress plugin- that he was getting a ‘Plugin could not be activated because it triggered a fatal error.’ message. Working through his problem is hopefully instructive for others, so here’s what we did.

Check the WordPress error message

Error messages appear for a very good reason. They’ll give you the clue as to what the problem is. So try to activate the plugin, and at the top of your plugins page, when a problem occurs, you’ll get an error message.

In many cases the problem exists because of a limit placed by the server setup on memory allocated to php. In this case you’ll get a ‘Allowed memory size of xxx bytes exhausted while upgrading WordPress‘. There’s a good discussion on how to fix this very common problem here

That, though wasn’t the problem for this client. Instead he was getting the following error:

Warning: main(/public_html/testsite/wp-content/plugins/mailchimp/MCAPI.class.php) [function.main]: failed to open stream: No such file or directory in/public_html/testsite/wp-content/plugins/mailchimp/mailchimp.php on line 28

This straight away gives us something concrete to work on. In the activation of the plugin the file MCAPI.class.php is called, and if not present will produce the above error.

“But it is there”, an increasingly frustrated client remarked – “after all, I uploaded the latest version of the plugin directly, and even went into the file-manager to check if the file was there!”.

A quick check on the server confirmed my  hunch. The file was there, but was in lowercase – rather than the specified MCAPI.class.php.  In grammatical terms I’m as guilty as the next for my often random capitalisation of terms. This often produces mild irritation from people reading things I’ve written, but rarely causes downright confusion – Web Servers, though, are a different case.

A file in lowercase is not necessarily the same as a file in uppercase – for example, on a unix system you can have both existing in the same folder.  So, the simple solution? A quick rename of the offending file to its correct uppercase format – and bob’s your uncle the mailchimp plugin was fine

The offender? Take a look at your ftp client

This solved the immediate problem, but how had it occured in the first place? After all, Client A. had done everything according to the book – he’d downloaded the latest version of the plugin. He’d checked that it was compatible with the version of wordpress he was running (this is another useful check to do whenever having problems with a plugin), and uploaded it.

A quick look at his ftp program settings revealed the problem. Using the wonderful Total Commander program, he’d missed one tell-tale setting which was causing all the problems:

wordpress ftp errorThat little box checked, ‘convert file names to lowercase’ was the problem. So, from now on, it’s unchecked, and all systems are go.

Have you had any other problems installing plugins, for which there was a simple solution? Let us know and we’ll link to them.

Tags: , , ,