• Resolved npanic

    (@npanic)


    I want to change the ‘Active WAF storage engine’ from ‘file system’ to the database, but i don’t have any clue to do it.
    Can someone help me ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support wfmark

    (@wfmark)

    Hello @npanic , and thanks for reaching out to us!

    If the firewall is optimized, you can add the line define(‘WFWAF_STORAGE_ENGINE’, ‘mysqli’); after <?php on a new line within /wordfence-waf.php. Wordfence will then save all its firewall data within the database instead of attempting to use the file system. If the firewall is not optimized, you’ll do that via the wp-config.php file. You can check to see if the firewall is optimized via Wordfence > Firewall > All Firewall Options > Protection Level, which will have a button saying “Remove Extended Protection” if it is optimized. Kindly check the link below for more information.

    https://www.wordfence.com/help/firewall/mysqli-storage-engine/

    Make sure the define(‘WFWAF_STORAGE_ENGINE’, ‘mysqli’); is in the correct bracket in the PHP file.

    Please note that we only recommend using this option if your site is unable to read and write to the firewall files consistently or if your host uses multiple web servers that do not share the same filesystem since better performance and efficient resource usage are likely when using the default file-based storage on most hosts.

    Thanks,

    Mark.

    Thread Starter npanic

    (@npanic)

    Hi, thanks for the answer !

    The firewall is optimized, so i added in the /wordfence-waf.php file the line : define(‘WFWAF_STORAGE_ENGINE’, ‘mysqli’); after the <?php.

    Now on the firewall configuration i have this :

    Wordfence Firewall Current WAF configuration.

    • WAF auto prepend active : Yes
    • Configured WAF storage engine (WFWAF_STORAGE_ENGINE) : mysqli
    • Active WAF storage engine : file system
    • WAF log path : ~/wp-content/wflogs/
    • WAF subdirectory installation : No
    • wordfence-waf.php path : /var/www/html/wordfence-waf.php
    • WAF File Permissions : 0600 – using template
    • Recently removed wflogs files : None
    • WAF Loaded Successfully : Yes*

    As you can see i still have the ‘Active WAF storage enfine set to file system, does it mean that the data is saved in the DB or not ?

    Thread Starter npanic

    (@npanic)

    Hello, if anyone facing the same issue i finded the fix !

    By default wordfence will try to get the database information from the wp-config.php file, and if you have a custom config, it will not find the DB variables.

    You need to add CONSTANTS in the wordfence-waf.php file :

    First add ‘define(‘WFWAF_STORAGE_ENGINE’, ‘mysqli’);’ in a new line under the ‘<?php’ tag.

    Then add :

    define(‘WFWAF_DB_NAME’, ‘db_name’);
    define(‘WFWAF_DB_USER’, ‘db_user’);
    define(‘WFWAF_DB_PASSWORD’, ‘db_password’);
    define(‘WFWAF_DB_HOST’, ‘127.0.0.1’);
    define(‘WFWAF_DB_CHARSET’, ‘utf8’);
    define(‘WFWAF_DB_COLLATE’, ”);
    define(‘WFWAF_TABLE_PREFIX’, ‘wp_’);

    And done ! Wordfence firewall will save data in the DB.

    To check if the config is good go in Wordfence > Tools > Diagnostics > Wordfence Firewall Current WAF configuration.

    If ‘Active WAF storage engine’ is set to ‘mysqli’ your done ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘MySQLi storage engine’ is closed to new replies.