Bug #1949


mod_geoip not setting environmental variables

Added by rolando about 15 years ago. Updated about 7 years ago.

3rd party
Target version:


Compiled mod_geoip as stated in the ModGeoip Docs, but it's not setting the env as it should, the lighty config:

server.modules = (

geoip.db-filename = "/usr/share/GeoIP/GeoIP.dat" 
geoip.memory-cache = "enable" 

to test that if module is working, I'm using this script:

#!/usr/bin/env ruby

require 'pp'
require 'rubygems'                                                                                   
require 'geoip'                                                                                      

pp ENV
DB ="/usr/share/GeoIP/GeoIP.dat")
country =['REMOTE_ADDR'])                                                             
pp country

the ENV shows nothing about geoip, but the same database, using the ruby bindings of the geoip library, works as supposed. Testing using the ubuntu 8.10 lighttpd package.

Actions #1

Updated by stbuehler about 15 years ago

  • Target version deleted (1.4.19)

How can you test with the ubuntu package if you needed to compile it yourself?

And 1.4.19 is pretty old... try it again with 1.4.22

And "Target version" is not the same as "affected version".

Apart from that mod_geoip is still a third pary module and not officially supported.

Actions #2

Updated by rolando about 15 years ago

since the only way to install mod_geoip is to compile it, I used debian-based tools (read: apt) to get the source, recompile and create another .deb package.
I will have to recompile and install by hand a newer version and test it. Although, you might want to check the forums, since there's another person with the same issue.

Actions #3

Updated by natethelen almost 15 years ago

I am also seeing this using fast-cgi and flup (python). I have traced it back to the raw socket read and none of the GEOIP_* FCGI_PARAMS are being sent through. What is weird is that they are passed through to PHP when run via fast-cgi with all else equal on the same box

Actions #4

Updated by gstrauss about 8 years ago

  • Category set to 3rd party
  • Status changed from New to Missing Feedback

mod_geoip adds variables to an environment array internally and that array is what is used for CGI, FastCGI, and SCGI, so if it is working in some cases and not others, I would suggest looking at your module load order to make sure geoip is run before those modules.

I uploaded a version of mod_geoip to which compiles against lighttpd 1.4.39.

If this is still an issue for you, please reopen ticket with more details on how to reproduce.

Actions #5

Updated by gstrauss about 7 years ago

  • Status changed from Missing Feedback to Fixed
  • Target version set to 1.4.46

Fixed in f5356302 (regardless of module ordering, as long as dynamic handlers run in the handler hook)


Also available in: Atom