Applicable to:
- Plesk for Linux
Question
How to install GeoIP php extension for PHP 7.0 and PHP 7.1 supplied by Plesk?
Answer
- Connect to the server via SSH.
- 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-databaseFor Debian/Ubuntu and PHP 7.1:
# apt-get install plesk-php71-dev build-essential
# apt-get install libgeoip-dev geoip-bin geoip-database - 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
- Add "
extension=geoip.so"
to the PHP's configuration (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
- 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
Note: for PHP versions other that 7.0 and 7.2, specify corresponding version in each step. For example:
# apt-get install plesk-php72-dev build-essential
# /opt/plesk/php/7.2/bin/php -m | grep geoip
Comments
9 comments
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?
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
@PiTiNiNjA, @Markus, thank you for your questions, article was updated.
Works perfectly on the new PHP7.1.8 by Plesk. Thanks!
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
Thanks a lot for the tutorial. It does not work on my machine with Ubuntu 16.04.3 LTS and Plesk Onyx Version 17.5.3 Update #30. PHP version is 7.0.18 by OS vendor FPM-App.
First, when I enter
I get the error message
Second, there is no such directory as
on my machine.
Could you provide me any help on that, please.
Thank you very much.
@Daniela, Hi!
This error message means that you do not have the corresponding entries in apt sources in your system. There should be '/etc/apt/sources.list.d/plesk.list' file with the following content:
## Persistent repositories for Plesk Products.
deb http://autoinstall.plesk.com/ubuntu/PSA_17.5.3 xenial extras
deb http://autoinstall.plesk.com/ubuntu/PHP53_17 xenial all
deb http://autoinstall.plesk.com/ubuntu/PHP54_17 xenial all
deb http://autoinstall.plesk.com/ubuntu/PHP55_17 xenial all
deb http://autoinstall.plesk.com/ubuntu/PHP56_17 xenial all
deb http://autoinstall.plesk.com/ubuntu/PHP70_17 xenial all
deb http://autoinstall.plesk.com/ubuntu/PHP71_17 xenial all
deb http://autoinstall.plesk.com/ubuntu/NGINX17 xenial all
As for /opt/plesk/php/7.0/bin/ directory, it is supposed to exist if you have PHP 7.0 installed through Plesk installer.
Hello,
is PHP 7.2.x supported?
@Siegfried Galun
Yes. Just specify corresponding PHP version for each step.
Please sign in to leave a comment.