You can have multiple WordPress installations with one PHP INI. But you need to do some work.
Here’s an example: https://blog.nintechnet.com/installing-ninjafirewall-with-hhvm-hiphop-virtual-machine/
Scroll down to the “Multiple-site installation” section. Although this article refers to HHVM, the problem is the same: installing multiple instances of NinjaFirewall with one single PHP INI.
Assuming you have 3 sites as per follows:
└── /home
└── /user
├── /domain_01.tld
│
├── /domain_02.tld
│
└── /domain_03.tld
1. Install NinjaFirewall on “domain_01.tld”, and load it from /home/user/.user.ini
(or php.ini depending on your host).
2. After the installation, comment out the auto_prepend_file directive to temporarily disable the firewall.
3. Repeat steps 1 and 2 with all other sub-domains.
4. Create a PHP script in your root folder, e.g., /home/user/my_script.php
.
5. Add this code to it and adjust the paths accordingly:
<?php
// Prepend the firewall for domain_01.tld:
if (strpos($_SERVER['SCRIPT_FILENAME'], '/home/user/domain_01.tld') !== false) {
// Load the firewall:
require('/home/user/domain_01.tld/wp-content/nfwlog/firewall.php');
// Prepend the firewall for domain_02.tld:
} elseif (strpos($_SERVER['SCRIPT_FILENAME'], '/home/user/domain_02.tld') !== false) {
// Load the firewall:
require('/home/user/domain_02.tld/wp-content/nfwlog/firewall.php');
// Prepend the firewall for domain_03.tld:
} elseif (strpos($_SERVER['SCRIPT_FILENAME'], '/home/user/domain_03.tld') !== false) {
// Load the firewall:
require('/home/user/domain_03.tld/wp-content/nfwlog/firewall.php');
}
6. Load the above script from the PHP INI auto_prepend_file directive:
; BEGIN NinjaFirewall
auto_prepend_file = /home/user/my_script.php
; END NinjaFirewall