How to install GeoIP php extension for PHP7 supplied by Plesk?

Created:

2017-03-23 00:01:04 UTC

Modified:

2017-08-23 05:57:20 UTC

4

Was this article helpful?


Have more questions?

Submit a request

How to install GeoIP php extension for PHP7 supplied by Plesk?

Applicable to:

  • Plesk for Linux

Question

How to install GeoIP php extension for PHP7.0 and PHP7.1 supplied by Plesk?

Answer

  1. Install required libraries and packages:
    For RHEL/CentOS and PHP 7.0:
    # yum install make plesk-php70-devel gcc glibc-devel GeoIP-devel zlib-devel

    For RHEL/CentOS and PHP 7.1:
    # yum install make plesk-php71-devel gcc glibc-devel GeoIP-devel zlib-devel

    For Debian/Ubuntu and PHP 7.0:
    # apt-get install plesk-php70-dev build-essential
    # apt-get install libgeoip-dev geoip-bin geoip-database

    For Debian/Ubuntu and PHP 7.1:
    # apt-get install plesk-php71-dev build-essential
    # apt-get install libgeoip-dev geoip-bin geoip-database
  2. Install GeoIP v. 111 with PHP7 support:
    For PHP 7.0:
    # /opt/plesk/php/7.0/bin/pecl install http://pecl.php.net/get/geoip-1.1.1.tgz

    For PHP 7.1:
    # /opt/plesk/php/7.1/bin/pecl install http://pecl.php.net/get/geoip-1.1.1.tgz
  3. Add " extension=geoip.so" to php.ini file:
    For PHP 7.0 modify file /opt/plesk/php/7.0/etc/php.ini
    For PHP 7.1 modify file /opt/plesk/php/7.1/etc/php.ini
  4. Check the installation:
    For PHP 7.0:
    # /opt/plesk/php/7.0/bin/php -m | grep geoip

    For PHP 7.1:
    # /opt/plesk/php/7.1/bin/php -m | grep geoip
Have more questions? Submit a request

5 Comments

  • 1
    Avatar
    PiTiNiNjA

    Thanks for this useful article. I tried to make it work on PHP7.1 but it didn't succeeded. Any chance you got it working on the newest version?

  • 1
    Avatar
    Markus Wernecke

    Hi Danila Dmitrienko,

    Installation was successful. Would be great to use it also for PHP 7.1.8

    What can I do with it. How to use it?

    Greets and Thanks for great help and work

    Edited by Markus Wernecke
  • 1
    Avatar
    Vitaly Zhidkov

    @PiTiNiNjA, @Markus, thank you for your questions, article was updated.

  • 0
    Avatar
    PiTiNiNjA

    Works perfectly on the new PHP7.1.8 by Plesk. Thanks!

  • 0
    Avatar
    Markus Wernecke

    Thanks Vitaly and all of You,

    I was so much involved with Plesk that I really didn't realized the error messages/emails from my server:

    Unable to load dynamic library '/usr/lib/php/20151012/geoip.so...

    In a crazy way it seems that I resolved it. But I'm not sure.

    Greets

Please sign in to leave a comment.