Troubleshooting NinjaFirewall installation problems.

Failed installation

This is the most common problem experienced by some users. At the end of the installation process, it displays the Error: the firewall is not loaded message.
You need to inform PHP to load NinjaFirewall before any other PHP scripts. This is done by adding the auto_prepend_file directive to your PHP user configuration file, usually named php.ini or .user.ini if you are running PHP as CGI/FCGI (see also PHP: The configuration file), or via a .htaccess file if you are running Apache with PHP as a module.

 As long as you do not provide the installer with the correct instructions, PHP will fail to load the firewall and the installer will keep displaying this error message.

php.ini

Most shared hosting accounts use this format. There are at least five different reasons why it can fail:

  • Your server is running suPHP : it is often used by hosting company to secure shared hosting accounts. It makes the php.ini non-recursive, i.e., its directives apply to the folder where the file is located but not to any other sub-folder. In that case, run the installer again and select Apache + suPHP. NinjaFirewall will add the suPHP_ConfigPath to your .htaccess in order to make it recursive.
    Note that there is no way for NinjaFirewall to detect if you are running suPHP, as this is a server side setting. You may have to ask your host about that.
  • Your PHP configuration makes the php.ini non-recursive: this problem is similar to the above issue, but without running suPHP. In that case, you will need to add the PHPRC directive to your .htaccess file:
<IfModule mod_env.c>
   SetEnv PHPRC /full/path/to/your/php.ini
</IfModule>

See this discussion for more details.

  • Your host does not allow the use of PHP INI files, or you may have a specific interface accessible in your hosting admin dashboard to use for that purpose: ask your host.
  • You server does not use php.ini but .user.ini file instead: simply rename the php.ini to .user.ini.
  • Your website is located inside a subfolder but your host only allows PHP INI files in the document root (e.g., Godaddy shared hosting plans).

How to check if your php.ini is recursive (cases #1 and #2 above) ?

  1. Run NinjaFirewall’s installer until you reach the Error: the firewall is not loaded message.
  2. Download our PHP script (WP/WP+ editionPro/Pro+ edition).
  3. Rename it to ninjacheck.php.
  4. Upload it into your website root folder, where you created the php.ini file.
  5. Goto http:// YOUR WEBSITE/ninjacheck.php
    If the script returns that the firewall is loaded, it means that your php.ini is not recursive and that you need to add either the suPHP_ConfigPath or PHPRPC directives to your .htaccess.

.user.ini

Since PHP 5.3, this is the default per-directory INI fileused by most dedicated/VPS servers, as well as shared hosting accounts that do not support php.ini. If your server can use either format, prefer .user.ini.
There are at least three reasons why it can fail:

  • Unlike php.ini.user.ini files are not reloaded immediately by PHP, but every five minutes. After making changes to that file, wait up to five minutes or, if this is your own server restart Apache (or PHP-FPM) to force PHP to reload it. The value to wait is displayed by the user_ini.cache_ttl directive which can be viewed with the phpinfo() function.
  • You server does not use .user.ini but php.ini file instead: simply rename the .user.ini to php.ini.
  • Your host does not allow the use of PHP INI files, or you may have a specific interface accessible in your hosting admin dashboard to use for that purpose: ask your host.

php5.ini

Very few hosting companies are using this format (some Godaddy hosting plans). If this file format does not work, consider using php.ini or .user.ini instead.

If you are still unsure about which INI file you should use, ask your host or your server administrator.

.htaccess

  • 500 Server Internal Error

This fatal error may occur if you are running PHP as an Apache module (mod_php). It is likely due to the fact that your Apache server does not allow the php_value directive to be added to your .htaccess. Your server logs will display the following error message:

/full/path/to/your/.htaccess: php_value not allowed here

To solve the problem, edit your main Apache configuration file and ensure that the AllowOverride directive is set to All instead of None for your vhost:

<Directory /path/to/your/website/folder>
   AllowOverride All
</Directory>

Restart Apache after making the change. If you are on a shared hosting account, contact your host about the issue.

  • Firewall not loaded

Similar to the above issue, edit your main Apache configuration file and ensure that the AllowOverride directive is properly set, otherwise Apache will ignore the .htaccess file.

If none of the above works, ask your host or your server administrator if you can use the PHP auto_prepend_file directive.

NinjaFirewall Help, Doc and FAQshttps://nintechnet.com/ninjafirewall/