Hi,
That means that there is an error when it tries to read its configuration from the database.
You can try our test script: http://nintechnet.com/ninjadb_php.txt
Rename it to ninjadb.php, upload it into your WordPress root folder (this is the folder where your index.php and wp-config.php are located by default), then visit http:// yourblog/ninjadb.php with your browser.
It will give more details about the DB connection.
Thank you.
Its a multisite setup. The script tires to select the wrong table.
The right table is usr_webx_2.wp_x2_options not usr_webx_2.wp_options.
Found wp-config.php.
Opening it for reading.
Looking for DB_NAME, DB_USER, DB_PASSWORD, DB_HOST and $table_prefix:
DB_NAME: found
DB_USER: found
DB_PASSWORD: found
DB_HOST: found
table_prefix: found
Attempting to connect to the DB: OK
Attempting to read NinjaFirewall's options (nfw_options) from the DB: Error: Table 'usr_webx_2.wp_options' doesn't exist
Exiting.
Is “wp_x2_” the table prefix in your wp-config.php file ?
No, the prefix in the wp-config.php is “wp_”
Its a multisite installation, so x2 is the ID of that multisite blog. Its called blog_id.
Here you can read about the multisite specific tables: https://codex.ww.wp.xz.cn/Database_Description#Site_Specific_Tables
Normally, the main site tables should be named “prefix” + “table” (e.g., wp_options) as usual and, of course, all other sites should have the blog_id inserted as you mentioned it.
Why does your main site has the blog_id #2 ? Did you delete the original or did you perform a specific installation?
Oh I understand.
My installation is very old (since WPMU), so I dont remember what exactly happened in the past.
The config table of my main site is wp_1_config. There is no wp_config table.
But I found the NinjaFirewall settings (nfw_options and nfw_rules) in the wp_config table of the blog, where I have installed the NF. Thats the table wp_62_options.
I am afraid you will not be able to run NinjaFirewall if your main blog has a blog_id inserted in its tables name.
Unlike all other security plugins that inherit the DB connection and all variables/constants from WordPress when it loads, NinjaFirewall needs to do all that work because it runs before WordPress. Default values are hard-coded and thus cannot be changed.
And if I create the table wp_config with the NF settings in it?
That won’t work because the firewall (that works before WP is loaded) will use it, but the plugin part of NinjaFirewall (that you can access from the admin dashboard to setup the firewall) will use the x2 table because it will rely on WP to read/write to/from the DB. In other words, that will be a big mess π
I tried that already. The NinjaFirewall seams to work. But yes, it reads always the old settings.
Is the no way to set the table prefix in the plugin?
You can try this, but I cannot guarantee you will not have any issue:
1. Uninstall NinjaFirewall.
2. Open your wp-config.php and locate this line:
$table_prefix = 'wp_';
Right below, add those 3 lines:
/*
$table_prefix = 'wp_x2_';
*/
The 1st and 3rd lines are opening/closing comment tags. That means PHP and WordPress will ignore the 2nd line. But it will be parsed by NF and when accessing the prefix + options table, it should point to the right “wp_x2_options” one.
3. Reinstall NinjaFirewall
But I really don’t know if you will get into problems or not.
Ensure that the firewall options are only accessible to the dashboard of the main site, and only to the superadmin.
OK, thank you for your help