Title: Cannot retrieve WordPress database credentials
Last modified: October 28, 2023

---

# Cannot retrieve WordPress database credentials

 *  Resolved [catuyen](https://wordpress.org/support/users/catuyen/)
 * (@catuyen)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/cannot-retrieve-wordpress-database-credentials-3/)
 * Hi
 * To improve the security of my website, I have moved wp-config.php to another 
   page, outside of public_html. Then, NinjaFireall displays an error “Cannot retrieve
   WordPress database credentials”.
 * What should I do? Can I still keep NinjaFirewall working while moving the wp-
   config.php file?
 * Thank you for your support!
   U
    -  This topic was modified 2 years, 7 months ago by [catuyen](https://wordpress.org/support/users/catuyen/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/cannot-retrieve-wordpress-database-credentials-3/#post-17158651)
 * You can use the [“.htninja” configuration file](https://blog.nintechnet.com/ninjafirewall-wp-edition-the-htninja-configuration-file/)
   to tell the firewall where is located your wp-config.php:
 * The code would be:
 *     ```wp-block-code
       <?php
       // To tell NinjaFirewall where you moved your WP config file,
       // use the '$wp_config' variable :
       $wp_config = '/full/path/to/wp-config.php';
       ```
   
 *  Thread Starter [catuyen](https://wordpress.org/support/users/catuyen/)
 * (@catuyen)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/cannot-retrieve-wordpress-database-credentials-3/#post-17159613)
 * Amazing!
 * Thanks again for your support

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cannot retrieve WordPress database credentials’ is closed to new replies.

 * ![](https://ps.w.org/ninjafirewall/assets/icon-256x256.png?rev=976137)
 * [NinjaFirewall (WP Edition) - Advanced Security Plugin and Firewall](https://wordpress.org/plugins/ninjafirewall/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ninjafirewall/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ninjafirewall/)
 * [Active Topics](https://wordpress.org/support/plugin/ninjafirewall/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ninjafirewall/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ninjafirewall/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [catuyen](https://wordpress.org/support/users/catuyen/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/cannot-retrieve-wordpress-database-credentials-3/#post-17159613)
 * Status: resolved