Upgrading to latest GeoIP PHP module on Debian
Lenny 5 (Install latest GeoIP from pear)
In order to be able to use the geoip function
geoip_time_zone_by_country_and_region I had to upgrade the
default debian lenny version of php5-geoip (1.0.3-1) to the
latest 1.0.7 aviable as
a pecl package.
In order to upgrade to the newer php-geoip 1.0.7 I had to first
remove the old php5-geoip version installed through debian package
manager.
debian-server:~# dpkg -r php5-geoip
Notice that if you don't do a apache restart after removing the
php5-geoip, if your php scripts has something that deals with php
geoip then your Apache server is gonna fail until restarted,
therefore to omit the failed Apache issues and possible downtimes
issue a apache restart before continuing.
debian-server:~# /etc/init.d/apache2 restart
Then I tried installing the newer php5 geoip
using
pecl
thus I issued:
debian-server:~# pecl install geoip
.... But guess what the built failed with an error:
checking for geoip files in default path... not
found
To deal with the php geoip compile issue I had to install:
libgeoip-dev - Development files for the GeoIP library
debian-server:~# apt-get install
libgeoip-dev
Then again I installed using the pecl interface pecl php pcakage
install interface.
debian-server:~# pecl install geoip
Thereafter I had to also include
extension=geoip.so in
php.ini
debian-server:~# echo "extension=geoip.so" >>
/etc/php5/apache2/php.ini
Needless to say for the new geoip module to take effect you need to
restart your Apache webserver.
debian-server:~# /etc/init.d/apache2
restart
Now this will enable the unexisting
geoip_time_zone_by_country_and_region function in the earlier
releases than 1.0.4 of php geoip.
So your geoip_time_zone_by_country_and_region should be
ready to use from your php scripts from now on.