• Resolved David

    (@digitalpurenetworks)


    NinjaFirewall fatal error : cannot retrieve WordPress database credentials. Please review your installation. Your site is not protected.

    I am getting this error suddenly in all my installs after I updated. No other changes were made. It was working fine previously, and the site is loading just fine. The status of the plugin says it is active also.

    Firewall Enabled
    PHP hook Enabled
    PHP SAPI – FPM-FCGI
    Engine version – 1.1.7
    Rules version – 20140212

    I would very much like to have this working. I have noticed a uptick in speed, and reliability of the site after installing your firewall. I have tried a few of the others, and while they are fun to play with not as useful as your firewall.

    https://www.ads-software.com/plugins/ninjafirewall/

Viewing 13 replies - 16 through 28 (of 28 total)
  • Plugin Author nintechnet

    (@nintechnet)

    The problem comes from the DB_HOST variable in your wp-config.php:
    ‘dbxxxxxx.db.1and1.com:3306

    Remove the port :3306 so that looks like this:
    ‘dbxxxxxx.db.1and1.com’

    There is no need to add it because that is the default MySQL port anyway, and it can lead to errors.

    Boy, you got it – even though the :3306 was added from the creation of the wp of mine and I didn’t touched it ever. So thank you very much!!!

    Now, what if you ARE using an alternative port, and the DBHost has x.x.x.x:1620? WordPress connects fine but I get the same fatal error as above. Why is Ninja ignoring the trailing port?

    Plugin Author nintechnet

    (@nintechnet)

    It will not work, because NinjaFirewall uses the PHP MySQLi extension which does not support the IP:Port format.
    This problem will be fixed in the next release (v1.2.6).

    Plugin Author nintechnet

    (@nintechnet)

    Version 1.2.6 was released today and can handle “host:port”, “host:socket” or “host:port:socket” formats.

    Regarding the table_prefix error… I get the error because I really DO NOT HAVE a table prefix on any of my tables.

    After I got the error and tried your code to get the status. I took a look at the WP MySQL DB and sure enough, I do not have a table prefix.

    I did not see that covered in this thread.

    How do I get Ninja Firewall to run?

    Plugin Author nintechnet

    (@nintechnet)

    Hi,

    How can your WordPress work without a table prefix ?
    WordPress would block any attempt to install it if there was no table prefix, as you can see from its setup-config.php script:

    if ( empty( $prefix ) )
       wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );

    I am not trying to argue with you but I am telling you the facts. there is no prefix on the database fields. Its the first time I have ever seen it myself.

    The person that installed WP on the site said she used Softalicious from cPanel and that Softalicious has a form field that lets you change the table prefix. She left that form field blank and Softalicious installed WordPress without any errors.

    The site was recently updated to WP $.0 and works perfectly fine with a number of other plugins so I did not think Ninja Firewall would give me an error.

    Since Ninja Firewall will not install, I have resorted to installing other security plugins to test and they all installed without any problems, but I’d prefer to use Ninja Firewall because I will know my site is secure.

    I considered reinstalling the blog and transferring the data to the new DB but the company owner does not want that.

    I am hoping that you have a work around or something I can try.

    Plugin Author nintechnet

    (@nintechnet)

    This is a serious bug in Softalicious, because the WP usermeta table relies on that prefix.
    Other plugins will work because they will inherit it (and all other constants/variables) from WP without checking it. But because NinjaFirewall works before WP, it has to search for the prefix and will return an error message if there is none.

    You can use the .htninja file and set an empty variable because NinjaFirewall will only check if it is set, not if it is empty. I did not test it, but I assume it should solve your issue:

    <?php
    /*
     +==================================================================+
     | NinjaFirewall optional configuration file                        |
     |                                                                  |
     | See: https://ninjafirewall.com/wordpress/htninja/                 |
     |                                                                  |
     +==================================================================+
    */
    
    // Set an empty table prefix:
    $nfw_['table_prefix'] = '';

    After reading the documentation on https://ninjafirewall.com I assume that the .htninja file affects all installations of NinjaFirewall. Is that correct? If so, whats happens when other sites are correctly installed with the table prefix?

    Plugin Author nintechnet

    (@nintechnet)

    That is not a problem. When NinjaFirewall will parse their wp-config.php file, if there is a table prefix it will use it and that will override the one you declared in the .htninja file.

    I gave that a try and received the following error after reinstalled Ninja Firewall:

    NinjaFirewall (WP edition)

    NinjaFirewall fatal error: cannot retrieve WordPress database credentials. Please review your installation. Your site is not protected.

    Then, below that is the following:

    Congratulations! NinjaFirewall is up and running. Use the menu in the left frame to configure it according to your needs.

    If you need help, click on the contextual Help menu tab located in the upper right corner of each page.

    I deactivated NinjaFirewall and restored another security plugin I have been using.

    Thanks for your help with this.

    Plugin Author nintechnet

    (@nintechnet)

    It looks like the .htninja file was not parsed.
    Maybe you have an open_basedir restriction preventing PHP scripts from accessing a file located outside your document root?
    You can see the open_basedir value with a simple phpinfo script.

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘Fatal Error: DB Credentials’ is closed to new replies.