• Resolved digitalsuite

    (@digitalsuite)


    I am using a custom WP setup with Roots/Bedrock where I save all my Environment Vars in a .env file. To run NinjaFirewall in full waf mode I want to use the MySQLi link identifier and read the vars from my .env file:

    $GLOBALS['nfw_mysqli'] = new mysqli( getenv('DB_HOST'), getenv('DB_USER'), getenv('DB_PASSWORD'), getenv('DB_NAME') , 3306 );

    Unfortunately, this does not work and NinjaFirewall cannot read those values. I’m wondering why that is the case. Hardcoding the values works as expected. I guess I could just hardcode the values, however I like to keep things central and since we have a dev, stg, and prd environment it would be great to just have one file that is responsible for the environment vars.

    I’m not running behind a proxy or any other security / firewall such as cloudflare. I am using oscarotero/env and vlucas/phpdotenvand tried loading the env file before the setting the ninja globals but with no success.

    Would greatly appreciate any help or suggestions as to why the vars are not read.

Viewing 1 replies (of 1 total)
  • Plugin Author nintechnet

    (@nintechnet)

    When is loaded the .env file? After the PHP INI file?

Viewing 1 replies (of 1 total)
  • The topic ‘ENV Vars not readable from .htninja’ is closed to new replies.