Title: SQLite / PDO support (wp-content/db.php)
Last modified: September 23, 2021

---

# SQLite / PDO support (wp-content/db.php)

 *  Resolved Anonymous User 17880307
 * (@anonymized-17880307)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/sqlite-pdo-support-wp-content-db-php/)
 * It seems the firewall relies on mysql(i) so we can not use other databases, for
   example SQLite for demonstration purposes, or any other PDO connection.
 * We use [https://github.com/aaemnnosttv/wp-sqlite-db](https://github.com/aaemnnosttv/wp-sqlite-db)
   with the WP-CLI server (but had to switch to the original PHP server, see also
   [https://github.com/wp-cli/server-command/issues/71](https://github.com/wp-cli/server-command/issues/71)):
 * [https://github.com/DanielRuf/run-local-wordpress/blob/main/run-local-wordpress.sh](https://github.com/DanielRuf/run-local-wordpress/blob/main/run-local-wordpress.sh)
 * The alternative solution `php -c .../.user.ini -S localhost:8080 -t .` also works
   but there is just a small warning in the backend then:
 * `Warning: Undefined array key "SERVER_ADDR" in .../wp-content/plugins/ninjafirewall/
   lib/dashboard.php on line 503`
 * There seems to be a simple solution with PDO ([https://www.php.net/manual/en/book.pdo.php](https://www.php.net/manual/en/book.pdo.php)):
 * [https://gist.github.com/DanielRuf/71eb70dc1dcf6503ce200871e2dfe25f/revisions#diff-cd52ce92891b0bf41db78d09547f2fc9e5ef21c5a1510b517fe6f6627a22a52f](https://gist.github.com/DanielRuf/71eb70dc1dcf6503ce200871e2dfe25f/revisions#diff-cd52ce92891b0bf41db78d09547f2fc9e5ef21c5a1510b517fe6f6627a22a52f)(
   very simple solution, there may be more parts that have to be changed)
 * PDO allows us to use more than just MySQL / MariaDB, see the list at [https://www.php.net/manual/en/pdo.drivers.php](https://www.php.net/manual/en/pdo.drivers.php)
 * At least it works now locally, in the backend it says `NinjaFirewall is running
   in Full WAF mode.` and the requests are correctly blocked.

Viewing 1 replies (of 1 total)

 *  Plugin Author [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * (@nintechnet)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/sqlite-pdo-support-wp-content-db-php/#post-14906279)
 * Maybe the simplest solution would be to let users add their own code to connect
   to the DB, fetch the rules and options in the .htninja script. Then, the firewall
   could simply check if `$nfw_['options']` and `$nfw_['rules']` are already populated
   and use them. That way, users could use whichever DB they want.
 * I would need to add some code to check whether `$_SERVER['SERVER_ADDR']` is populated
   or not.

Viewing 1 replies (of 1 total)

The topic ‘SQLite / PDO support (wp-content/db.php)’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [nintechnet](https://wordpress.org/support/users/nintechnet/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/sqlite-pdo-support-wp-content-db-php/#post-14906279)
 * Status: resolved