Title: PHP Notice
Last modified: December 1, 2018

---

# PHP Notice

 *  [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * (@rfischmann)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/php-notice-121/)
 * Hi,
 * My error_log is full of these:
 * `[01-Dec-2018 00:52:02 UTC] PHP Notice: Undefined index: REMOTE_ADDR in /home/
   macmagazine/public_html/wp-content/plugins/insert-post-ads/includes/geotargeting.
   php on line 299`
 * Any tip for a fix?
 * Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Thread Starter [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * (@rfischmann)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/php-notice-121/#post-10988617)
 * Any help?
 *  Thread Starter [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * (@rfischmann)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-notice-121/#post-11007106)
 * I’ve tried to fix it myself.
 * Changed line 299 from:
 * `$userIp = $_SERVER["REMOTE_ADDR"];`
 * To:
 *     ```
       if (isset($_SERVER["REMOTE_ADDR"])) {
           $userIp = $_SERVER["REMOTE_ADDR"];
       }
       ```
   
 * However, then this happens:
 * > [19-Dec-2018 11:48:03 UTC] PHP Notice: Undefined variable: userIp in /home/
   > macmagazine/public_html/wp-content/plugins/insert-post-ads/includes/geotargeting.
   > php on line 305
 * I’ll just wait for your official support.
 *  Thread Starter [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * (@rfischmann)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-notice-121/#post-11049430)
 * [@insertpostads](https://wordpress.org/support/users/insertpostads/) Any help
   here, please?
 *  [insert-post-ads](https://wordpress.org/support/users/insertpostads/)
 * (@insertpostads)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-notice-121/#post-11051481)
 * hey Rafael!
    Do you use local server?
 *  [insert-post-ads](https://wordpress.org/support/users/insertpostads/)
 * (@insertpostads)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-notice-121/#post-11051586)
 * [@rfischmann](https://wordpress.org/support/users/rfischmann/) try to replace
 * $_SERVER[“REMOTE_ADDR”];
 * With:
 * $_SERVER[“HTTP_X_REAL_IP”];
 *  Thread Starter [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * (@rfischmann)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-notice-121/#post-11051839)
 * [@insertpostads](https://wordpress.org/support/users/insertpostads/) Hi! Thanks
   for getting back to me.
 * I don’t know what you mean by “use local server”. This is running live.
 * I tried what you said and the error just changed slightly:
 * `[04-Jan-2019 12:40:02 UTC] PHP Notice: Undefined index: HTTP_X_REAL_IP in /home/
   macmagazine/public_html/wp-content/plugins/insert-post-ads/includes/geotargeting.
   php on line 299`
 *  Thread Starter [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * (@rfischmann)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/php-notice-121/#post-11292380)
 * [@insertpostads](https://wordpress.org/support/users/insertpostads/) Any help
   on the issue above? My error_log keeps getting hammered by that PHP Notice, once
   every minute…
 * `[09-Mar-2019 01:09:02 UTC] PHP Notice: Undefined index: REMOTE_ADDR in /home/
   macmagazine/public_html/wp-content/plugins/insert-post-ads/includes/geotargeting.
   php on line 299`
 *  Thread Starter [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * (@rfischmann)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/php-notice-121/#post-11535403)
 * Still waiting.
 *  Thread Starter [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * (@rfischmann)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-121/#post-11732718)
 * Issue remains, unfortunately.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘PHP Notice’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/insert-post-ads_f9f9f9.svg)
 * [Insert Post Ads](https://wordpress.org/plugins/insert-post-ads/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-post-ads/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-post-ads/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-post-ads/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-post-ads/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-post-ads/reviews/)

## Tags

 * [log](https://wordpress.org/support/topic-tag/log/)
 * [notice](https://wordpress.org/support/topic-tag/notice/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 9 replies
 * 2 participants
 * Last reply from: [Rafael Fischmann](https://wordpress.org/support/users/rfischmann/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/php-notice-121/#post-11732718)
 * Status: not resolved