Reply To: PHP Warning: Undefined array key "REMOTE_ADDR"

Home Forums Support Forum PHP Warning: Undefined array key "REMOTE_ADDR" Reply To: PHP Warning: Undefined array key "REMOTE_ADDR"


Anti-Malware Admin
Key Master

Your hosting support did not understand or explain the problem correctly, but I can help make it clear and present a workaround for you to use to get rid of that error without disabling the Brute-Force Protection.

First, just to clarify, the first part of that if statement on linw 1 or your wp-config.php file is not limit the protection to one IP but rather to exclude the given IP from the Brute-Force Protect (effectively whitelisting your originally detected admin IP address).

if (!in_array($_SERVER["REMOTE_ADDR"], array(“*********”)) && file_exists(…

The problem is that your cronjob executes the PHP process without setting the $_SERVER environment variable indexed as “REMOTE_ADDR”. This causes the PHP Warning message you are seeing.

The simplest solution is to just remove that first condition from the if statement, leaving the file_exists condition intact. This would result in the first line of your wp-config.php file starting like this:

if (file_exists(…

Please let me know if you need any further assistance with this.