Jim Ohlstein Wrote:
-------------------------------------------------------
> I don't think "$geoip_country_by_name" takes an
> argument like that, but rather returns data based
> on the client's IP. At least it's not in the Wiki.
> See http://wiki.nginx.org/NginxHttpGeoIPModule.
> Even if it did it should never find one that since
> it's an internal IP. Further, you can only use
> that variable within nginx's configuration files,
> not within a PHP script.
>
> Something like
>
>
> if ($geoip_country_code = XX) {
> do something;
> }
>
> if ($geoip_country_code = YY) {
> do something else;
> }
>
>
> It's possible that you can pass
> $geoip_country_code as a fastcgi_param and then
> use it within you PHP script(s) as necessary. I
> haven't tried it so YMMV/
FYI, I read this post and this technique works. For future reference for others. Just add to your configuration file:
fastcgi_param COUNTRY $geoip_country_name;
fastcgi_param CITY $geoip_city;
fastcgi_param REGION $geoip_region;
... and the PHP script has access to the GeoIP data. This significantly improved performance on my app versus the default PHP module for geoip.