[Defender Pro] Multiple php errors occur when the site is pushed into staging and dev environments.

Multiple php errors occur when the site is pushed into staging and dev environments. (e.g. https://www.rein.com –> reindev.wpengine.com).

4012 PHP Fatal error: Uncaught InvalidArgumentException: Error opening “/nas/content/live/rein/wp-content/uploads/wp-defender/maxmind/GeoLite2-Country_20191022/GeoLite2-Country.mmdb”. in /nas/content/live/reinstaging/wp-content/plugins/wp-defender/vendor/hammer/vendor/maxmind-db/reader/src/MaxMind/Db/Reader.php:54\nStack trace:\n#0 /nas/content/live/reinstaging/wp-content/plugins/wp-defender/vendor/hammer/geoip/geoip.php(18): MaxMind\\Db\\Reader->__construct(‘/nas/content/li…’:wink:\n#1 /nas/content/live/reinstaging/wp-content/plugins/wp-defender/app/module/ip-lockout/component/ip-api.php(171): Hammer\\GeoIP\\GeoIp->__construct(‘/nas/content/li…’:wink:\n#2 /nas/content/live/reinstaging/wp-content/plugins/wp-defender/app/module/ip-lockout/model/settings.php(587): WP_Defender\\Module\\IP_Lockout\\Component\\IP_API::getCurrentCountry()\n#3 /nas/content/live/reinstaging/wp-content/plugins/wp-defender/app/module/ip-lockout/controller/main.php(180): WP_Defender\\Module\\IP_Lockout\\Model\\Settings->isCountryBlacklist()\n#4 /nas/content/live/reinstaging/wp-cont in /nas/content/live/reinstaging/wp-content/plugins/wp-defender/vendor/hammer/vendor/maxmind-db/reader/src/MaxMind/Db/Reader.php on line 54

  • Adam
    • Support Gorilla

    Hi Jaime

    I hope you’re well today and thank you for your question!

    The issue is about paths that, for some reason, don’t get updated. The error states that defender is trying to read the file from the path that starts with

    /nas/content/live/rein/

    while the correct one in this case would be

    /nas/content/live/reinstaging/

    Based on “live” part in that path I don’t think you are using WPEngine’s built-in “production/staging” tools, right? It seems like the site is pushed between two separate locations and that would mean that the path would have to be updated. Whether it does or not might actually depend on the way such “migration” is done.

    Would you tell me, please, what tool(s) are you using for it/how do you do such “push”?

    Also, have you tried to simply deactivate Defender (on the site that gives errors), clear all possible caches and the re-enable it and just re-save all its settings without making any changes? There’s a good chance it might update the paths so would be worth checking meanwhile.

    Best regards,
    Adam

  • Jaime
    • Site Builder, Child of Zeus

    Good Morning,

    Confirming we are using WP Engine’s built in tools to push from production to their other environments (staging / dev).

    [attachments are only viewable by logged-in members]

    When pushed the error occurs. Yes we could deactive, however, if possible, I prefer to identify the error to prevent additional steps and to ensure additional errors do not occur. Please let us know if we can grant access for you to replicate or how else we can assist.

  • Predrag Dubajic
    • Support

    Hi Jamie,

    I don’t have a full WP Engine access, but I do have a site there where I can access WP Engine settings from WP admin section.
    I see that the staging option there is changed to Legacy Staging so I’m guessing that the one from the user panel is different from that and the Legacy Staging worked fine for me.
    Pushing the site to staging and back to production from staging both worked without any issues and I didn’t encounter any fatal errors.

    It’s possible that the User Panel migration works in a different way causing some DB tables not to be updated correctly.
    Can you check with WP Engine support and mentioned that Legacy Staging works fine and if they have some info on the difference between migration function between the two that could be causing these issues?

    Best regards,
    Predrag