All editions of NinjaFirewall (WP, WP+, Pro and Pro+) are compatible with the latest PHP 7. However, because the firewall needs to be loaded by PHP via a directive added to your INI or .htaccess file, there could be a few minor issues that you may need to fix manually.
Note that the following issues apply only if you already have NinjaFirewall installed and running on the server you are upgrading from PHP 5 to 7.
Apache with mod_php and .htaccess
If you are running Apache with PHP as a module (mod_php), NinjaFirewall directive was added to your main .htaccess file during the installation process:
# BEGIN NinjaFirewall <IfModule mod_php5.c> php_value auto_prepend_file /path/to/.../lib/firewall.php </IfModule> # END NinjaFirewall
After the upgrade, the
<IfModule mod_php5.c> directive will be ignored by PHP 7 and the firewall will not be loaded. To solve this problem, follow these steps:
- Upgrade to PHP 7.
- Edit your .htaccess and replace the
# BEGIN NinjaFirewall <IfModule mod_php7.c> php_value auto_prepend_file /path/to/.../lib/firewall.php </IfModule> # END NinjaFirewall
There is no need to restart Apache.
- Log in to NinjaFirewall administration interface (Pro/Pro+ Edition) or WordPress admin dashboard (WP/WP+ Edition) and ensure that the firewall is loaded.
The following issue can only happen if the firewall directive was added to a php.ini or php5.ini file: after upgrading to PHP 7, NinjaFirewall may complain that it not loaded or it may start again its installation process.
If this happens to you, try to rename your php.ini (or php5.ini) file to .user.ini, which is the default and preferred per-directory INI file. Note that .user.ini files are not reloaded immediately by PHP but every five minutes, therefore wait up to five minutes or, if this is your own server, restart Apache (or PHP-FPM) to force PHP to reload it.