How to install and activate plugin manually without wp-admin dashboard

This post is to elaborate, how to manually install and activate the plugin without using wp-admin dashboard but we must be having FTP access to the domain hosting ( godaddy, bluehost etc) to upload files.

Step1:

Download the plugin you wanted to install, in my case its "shortcoder" plugin

available here https://wordpress.org/plugins/shortcoder/

you will get a zip file when you download this plugin from there. i.e: shortcoder.4.1.3.zip

uncompress it, you will get a plugin folder inside, in my story its shortcoder

Just a tip: maximum plugin folders will be designed like <pluginname>/<pluginname>.php by knowing this, you can bet which is your plugin folder

Step2:

Login to your FTP account, in my case its GoDaddy, you can either use CPanel (or) If you have SSH access enabled you can use winscp to upload the file.

Where to upload the file?  <Documentroot of your website>/wp-content/plugins

i.e: ~/public_html/mwinventory.in/wp-content/plugins

Since I have SSH Access, I am directly uploading the file using winscp

docroot

 

copy your pluginfolder from your local desktop to server plugins directory ( select the file > drag it from left to right ) sorry for this silly instruction:))

Step3

find the DB name for your WordPress installation, but how ?

in ftp (or) terminal go to document root of your domain and find the file "wp-config.php", open it and search for the following string

define('DB_NAME', 'i767660_wp1');

in my case i767660_wp1 is my DB

Step 4:

Being aware of the DB name, now you can log in to hosting provider and launch phpmyAdmin

phpmyadmin

in phymyAdmin, left side navigation panel, click and expand your DB and select the table "wp-options" and in the browse section find the record/row (option-name) containing "active-plugins"

phpmyadmin2

 



the value(option-value) of this would generally be with some number, which is called serialized. you cannot directly add your plugin name there.

The right procedure is, copy the option-value for active-plugins and unserialize it and append your plugin name then re-serialize it.

Ohh man.. How ?

Here is the code you can use to get it done. ( you can execute this code anywhere in your php installed system/server)

<?php

$unserialized = unserialize('COPY THE OPTION_VALUE OF ACTIVE_PLUGINS HERE');
array_push($unserialized, 'shortcoder/shortcoder.php');
$serialized = serialize($unserialized);
echo $serialized; // Copy this output back into the database

?>

Here you can see,  I have placed the plugin folder and plugin file, which I wanted to activate

shortcoder/shortcoder.php

Now run the the script like php <scriptname.php>

your output will be similar to the following

sarav@p3plcpnl0553 [/var/tmp]$ php test.php
a:4:{i:0;s:45:"limit-login-attempts/limit-login-attempts.php";i:1;s:29:"pirate-forms/pirate-forms.php";i:2;s:33:"toggle-wpautop/toggle-wpautop.php";i:3;s:25:"shortcoder/shortcoder.php";}

 

terminal

 

copy the output of this script and update the value of active_plugins (option_value)

updatedb

 

 

we made it! Yes thats how we can install and activate a plugin without using wp-admin. But the ironic fact is that you should go to wp-admin now to verify it 😀

Cheers

A K S A R A V