I'm trying to get the Ad GeoIP module working, and to do this, I have to install the PHP geoip extension. I'm running apache under OS X 10.5.5.

The process is pretty tortuous (and will be the subject of a "how to" blog if I ever succeed in completing it), but I appear to have got through all the required steps, resulting in a properly compiled geoip.so file in my PHP extension directory, and the appropriate "extension=geoip.so" line in my php.ini. And indeed, if I type "php -i" from the command line, geoip 1.0.3 is suitably present and correct.

But here's the snag - only from the command line. Operated from a web browser, phpinfo() shows no sign of it. The other extension (gd.so) appears just fine - but geoip is invisible. And indeed, the Drupal Ad GeoIP module can't find it either. As far as I can see, the other results from the two versions of the info screen are identical. I've tried a reboot of the whole OS, but to no avail.

Do any of you PHP experts have any idea how this can happen? I assumed the command line and web server versions of the info function were pointing at the same place, but evidently not!!! Or I'm doing something *really* stupid that I can't spot!!!

Thanks for any ideas

David

Comments

xgretsch’s picture

Looking at this again, I can see the following error in the Apache log whenever Apache starts:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/geoip.so' - (null) in Unknown on line 0

Once again, only from the web server, not from the command line. Does anyone know what this error means?

xgretsch

rf152’s picture

I cant say I'm experienced with any version of Apple OS, but my guess would be that the file location is wrong. Does the file

/usr/lib/php/extensions/no-debug-non-zts-20060613/geoip.so

actually exist? If it does, does the user that the web server is running as have access rights to it?

If its not those two, then I cant say what it would be.

xgretsch’s picture

The file does exist and has the right access rights. My guess at the moment is that the path is different: my command shell gets several directories into the path, one of which (/opt/local/bin) has some geoip-related files in it. I've tried putting symbolic links to these in a directory in what Apache thinks is the path, to no avail.

xgretsch

dhoward’s picture

David, could you elaborate on the "how to" you alluded to? I am struggling right now with trying to create the Apache mod_geoip.so for OS X 10.5.5. When I follow the instructions that came with mod_geoip2_1.2.2:

sudo apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c

, it creates the extension and installs it in /usr/libexec/apache2. But then here's what I get from 'apachectl configtest':

apachectl configtest
httpd: Syntax error on line 118 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_geoip.so into server: dlopen(/usr/libexec/apache2/mod_geoip.so, 10): no suitable image found.  Did find:\n\t/usr/libexec/apache2/mod_geoip.so: mach-o, but wrong architecture

Wrong architecture?!

Rainy Day’s picture

Did you figure out how to get GeoIP going under Apache on Leopard? Did you write the How to? TIA.