Activate a plugin through PHPMyAdmin or FTP?

I’ve just disabled a plugin on my site and it’s now giving me the dreaded white screen of death. I know the site will be fine if I reactivate the plugin.

Is there a way to manually activate a plugin through PHPMyAdmin or over FTP?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I fixed this by going through PHPMyAdmin to the table “Options” and then the row active_plugins.

I had the following stored there (formatted for readability):

a:10:{
    i:0;s:49:"1and1-wordpress-wizard/1and1-wordpress-wizard.php";
    i:1;s:29:"acf-repeater/acf-repeater.php";
    i:2;s:30:"advanced-custom-fields/acf.php";
    i:3;s:45:"limit-login-attempts/limit-login-attempts.php";
    i:4;s:27:"redirection/redirection.php";
    i:6;s:33:"w3-total-cache/w3-total-cache.php";
    i:7;s:41:"wordpress-importer/wordpress-importer.php";
    i:8;s:24:"wordpress-seo/wp-seo.php";
    i:9;s:34:"wpml-string-translation/plugin.php";
    i:10;s:38:"wpml-translation-management/plugin.php";
}

I added a new line (for the missing plugin) and incremented the a:10 to a:11 to indicate that there are now 11 items in the array:

a:11:{
    i:0;s:49:"1and1-wordpress-wizard/1and1-wordpress-wizard.php";
    i:1;s:29:"acf-repeater/acf-repeater.php";
    i:2;s:30:"advanced-custom-fields/acf.php";
    i:3;s:45:"limit-login-attempts/limit-login-attempts.php";
    i:4;s:27:"redirection/redirection.php";
    i:5;s:40:"sitepress-multilingual-cms/sitepress.php";
    i:6;s:33:"w3-total-cache/w3-total-cache.php";
    i:7;s:41:"wordpress-importer/wordpress-importer.php";
    i:8;s:24:"wordpress-seo/wp-seo.php";
    i:9;s:34:"wpml-string-translation/plugin.php";
    i:10;s:38:"wpml-translation-management/plugin.php";
}

i: appears to be item number, and thanks to JHoffmann’s comment, it appears s: is the length of the string that follows.

The site now works as before!

Method 2

//Using this code you can activate your plugin from the functions.php
    function activate_plugin_via_php() {
        $active_plugins = get_option( 'active_plugins' );
        array_push($active_plugins, 'unyson/unyson.php'); /* Here just replace unyson plugin directory and plugin file*/
        update_option( 'active_plugins', $active_plugins );    
    }
    add_action( 'init', 'activate_plugin_via_php' );

Method 3

Just another answer for a different approach that could benefit someone else in the future.
You could also move the plugin folder to the Must Use folder (which you will probably need to create if not used before. This path is usually:

wp-content/mu-plugins

Plugins in this folder will always run. Refer to the following for more info:

https://codex.wordpress.org/Must_Use_Plugins

Note: The only thing to consider is that these plugins are loaded before others in the plugins folder.
Also refer to the caveats in the above link as there may be other issues that could prevent your plugin working correctly.

Method 4

You can simply rename the plugin folder, for example:

"_aksimet" to deactive it
and than back to
"aksimet" to activate it again (if was active)

you can do that with all “plugins” folder together.

Otherwise, go to MySQL and have a look at this step by step manual, in short:

  1. MYSQL > wp_options
  2. search for active_plugins entry
    (both steps can be done by SELECT * FROM wp_options WHERE option_name = 'active_plugins';)
  3. and than write your plugin there as the other plugins are written (i is index, s is for the length of string).

Hope it helps


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x