Hi,

I've installed GEOS following these steps:

[root@15900696 ~]# cd /usr/share
[root@15900696 share]# wget http://download.osgeo.org/geos/geos-3.3.2.tar.bz2
[root@15900696 share]# tar -xvjf geos-3.3.2.tar.bz2
[root@15900696 share]# cd geos-3.3.2
[root@15900696 geos-3.3.2]# ./configure && make clean && make
[root@15900696 geos-3.3.2]# make install
[root@15900696 geos-3.3.2]# ldconfig
[root@15900696 geos-3.3.2]# vi /etc/ld.so.conf

Added the line:
/usr/local/lib

Saved (ESC -> :x) 
Run ldconfig
[root@15900696 geos-3.3.2]# /sbin/ldconfig

Then I've checked it's properly installed:

[root@s15900696 ~]# geos-config --version
3.3.2

Then I've installed GeoPHP 7.x-1.4. In the status report I get the message:

GeoPHP library installed and OK. However, GEOS is was not found. While not required, you will see performance improvements if you install the GEOS PHP extension. See the following link for more information.https://github.com/phayes/geoPHP/wiki/GEOS

It seems that GeoPHP doesn't find the location of GEOS.

Any idea about how to solve this problem?

Thanks!

CommentFileSizeAuthor
#35 fixphp8.0_deb.patch21.86 KBdenix
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

netbek’s picture

I've had success with these instructions http://wygoda.net/blog/testing-geos-33-php-bindings I think you're missing ./configure --enable-php, and see the note at the end about /etc/php5/conf.d/geos.ini.

ecalcerrada’s picture

Thanks you very much, Hein. The problem was php bindings, in effect.

I'm working on Centos 6, so I've followed a slightly different approach than the blog you mentioned:

# cd /usr/share
# wget http://download.osgeo.org/geos/geos-3.3.2.tar.bz2
# tar -xvjf geos-3.3.2.tar.bz2
# cd geos-3.3.2
# ./configure --enable-php && make clean && make
# make install
# ldconfig
# vi /etc/ld.so.conf

Add the line:
/usr/local/lib

Save (ESC -> :x) 

Run ldconfig

# /sbin/ldconfig

create a /etc/php.d/geos.ini file with the following content:

; GEOS extension
extension=geos.so

It works perfectly.

Thanks again.

netbek’s picture

Status: Active » Fixed

Great!

phayes’s picture

Thanks for the exta info. I'm going to add these instructions to the geoPHP wiki page.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dzieyzone’s picture

Hi, I was able to install it in my CentOS 5.8 however when I followed the same instruction to another server running CentOS 6.3, it can't locate the /usr/local/lib folder and what is weird is that when I check the ldconfig the folder seems to be there.
I'm using PHP-fpm by the way.

deanflory’s picture

I tried numerous times with all the linked instructions that would work on my CentOS 5 server and none would work, kept getting the GEOS not installed on the reports page after a manual cron run.

This mix DID work for me, maybe it will help others but since I have no idea if certain things were not required for my installation or not, they may not all apply but in the end it did finally work (after 3-4 different methods at least 3 times each):

yum install gcc gcc-c++

svn checkout http://svn.osgeo.org/geos/trunk geos-svn

cd geos-svn
./autogen.sh
./configure
./configure --enable-php && make clean && make
make check
make install

ldconfig
vi /etc/ld.so.conf
Add the line:
/usr/local/lib
Save (ESC -> :x) OR simply press Escape then press ZZ to exit and save

As I found vi to be a cryptic and non-user friendly interface where you can't tell if you've actually done anything, I also checked the file with pico to make sure it was actually modified, which it was:
pico /etc/ld.so.conf

Run ldconfig:
ldconfig
/sbin/ldconfig

Next, create a /etc/php5/conf.d/geos.ini file with the following content. I did have a /etc folder but did not have a php5 or therefore conf.d folder so I created those with:
cd /etc
mkdir php5
cd php5
mkdir conf.d
cd conf.d
pico /etc/php5/conf.d/geos.ini
Copy & paste this into the geos.ini file:

; GEOS extension
extension=geos.so

Exit (control + x) and Save (control + something I can't remember now, maybe o "oh")

Gracefully restarted my server.
Restarted Apache for good measure.

Check it's properly installed:
geos-config --version
Result was "3.3.2", which is what I was able to get before Drupal/server would properly register it, so ultimately this told me I was doing something right but wasn't the end-all "done" notification.

Bam. Now when I run cron manually (in maintenance mode) and end up on the Status Report page I no longer get the GEOS missing error entry, but instead the lovely new additional next step of:

Old GeoPHP Library
GeoPHP library version 1.0 was found, but you are running an old version. GeoPHP version 1.1 is bundled with this module. Please either remove or update your older version of geoPHP found at sites/all/libraries/geoPHP/geoPHP.inc. The newest version of geoPHP can be found at https://github.com/downloads/phayes/geoPHP/geoPHP.tar.gz.

The link to the github tar.gz appears to still be v1.0, but uploading the geoPHP folder within the geophp module folder to the libraries folder removed the not-using-v1.1 notice on the Status Reports page...

...BUTTTTTTTT after doing so, I get the old GEOS is not installed error/notice. So something isn't right here, going back to installing the old geoPHP library though I'm not sure if that really means GEOS is actually installed and working. This is not fun or productive.

I again deleted the geosPHP library from the libraries folder and reuploaded the version/folder that was within the module folder, which once done continued to show the GEOS not installed on the Status Report page. meh

So, following the zillion breadcrumbs............got me really nowhere. For server techs this might be easy but for a designer like myself I find there are often, what I think are intentional, gaps in instructions for installing things on servers, though I do understand how different distributions and builds can vary. On with actual forward progress and to hell with GEOS since it's clear there is some other mystery configuration I'm just supposed to "know" how to do. Not worth 3 different sessions with really no noticeable result. (sorry, a bit annoyed again at not being able to put this behind me again, again)

Thanks for everyone's help!

liquidcms’s picture

Status: Closed (fixed) » Active

i have Cento6 and ran through #2.

geos-config --version gives me 3.3.2

but status report still states: GEOS not found.

phayes’s picture

liquidcms,

Do you have the GEOS php extension enabled in php.ini ?

liquidcms’s picture

likely not; just did what it said in #2

John Pitcairn’s picture

Anyone gotten this to work on Ubuntu 12, installing the libgeos-3.2.2 package via apt-get?

scottalan’s picture

For anyone still trying to install the GEOS PHP extension on Ubuntu 12.04.

I already had the necessary packages installed on my server but you may need run: sudo apt-get install build-essential if you run into any errors during the compile process.

These are the steps I took:

In my $HOME folder -

// Clone from github.

git clone git@github.com:libgeos/libgeos.git geos
cd geos

// Check out the branch you want. I chose to use 3.3.

git checkout origin/svn-3.3 && git checkout -b 3.3

// Next

./autogen.sh
./configure --enable-php
make
make check

// Using this instead of just calling `make install`. `sudo apt-get install checkinstall`.
// You can just use `make install` if you want. Read about it here: http://checkinstall.izto.org/

sudo checkinstall // May want to actually add a version when it asks you.

When it's finished there's just one more thing to do:

In /etc/php5/conf.d Add a file: geos.ini This file should contain: extension=/usr/lib/php5/20090626+lfs/geos.so This should be the correct location for the geos.so file but if it's not then just adjust the path accordingly.

That's it! Refresh the admin/reports/status page and you should see it's installed.

Note: You can remove the geos folder that git created from your $HOME folder.

bluecobalt’s picture

On Centos 6, I did everything in #2 and found that the geos.ini file did not work.

I copied the contents of the geos.ini file to my /usr/local/lib/php.ini file, restarted my server, and presto it works!

This is what I put at the bottom of my php.ini file:

; GEOS extension
extension=geos.so
deanflory’s picture

bluecobalt, you are my hero! *blink* *blink* ;)

I'm on CentOS 5.8 and adding "extension=geos.so" to the /usr/local/lib/php.ini seemed to do the trick to get it recognized in the Status report after a manual cron run.

Alas!:

GeoPHP and GEOS GEOS PHP extension Installed

pedrosp’s picture

I am definitely not able to install this GEOS extension on Ubuntu 12.04LTS...
So sad that the "apt-get install libgeos-dev" did just not work.

I followed #12 ( with the following sequence):

apt-get install build-essential
apt-get install checkinstall
cd /home
git clone git://github.com/libgeos/libgeos.git 
cd libgeos
git checkout origin/svn-3.3 && git checkout -b 3.3
./autogen.sh
./configure --enable-php
make
make check

There is no geos.so file on the expected /usr/lib/php5/20090626/geos.so
Ain't no fun at all.

iaminawe’s picture

Using BOA to install GEOS and can confirm it is working and geos is installed and gives a version number. The geos.so file is is in my /opt/local/etc/php53.ini but I still get no love on the drupal status screen. I am also on Ubuntu 12.04LTS.

Any assistance or patches to test would be great. Thanks

RaulMuroc’s picture

The instructions of:

http://wygoda.net/blog/testing-geos-33-php-bindings

Are not accessible. Perhaps the server is down :S

iaminawe’s picture

I ran the BOA setup again and GEOS seems to have being detected correctly now within Drupal.

sethviebrock’s picture

I would recommend not installing directly from source. Instead, use the autogen.sh command found in the git or svn versions. I used the svn method because installing from source lead to issues. Then, I noticed that during the configure --enable-php command it said "configure: WARNING: php-config not found, php support disabled" (solution to this given below).

At the end of ./configure --enable-php it should look like this:

Swig: false
Python bindings: false
Ruby bindings: false
PHP bindings: true

If "PHP bindings" is set to "false", it's because PECL and possibly php5-dev are not installed. See http://www.mkfoster.com/2009/01/04/how-to-install-a-php-pecl-extensionmo...

Once I installed PECL and php5-dev, then everything worked like a charm, and the output to ./configure --enable-php had "PHP bindings" set to true.

pedrosp’s picture

I made it finally work that way:

apt-get install autoconf build-essential checkinstall libtool php5-dev phpunit subversion
cd /home
svn checkout http://svn.osgeo.org/geos/trunk geos-svn
cd geos-svn
./autogen.sh
./configure --enable-php
sudo checkinstall

I followed also those instructions to fill-in options during the checkinstall process.
Then created the /etc/php5/conf.d/geos.ini file with the following content:

; GEOS extension
extension=geos.so

and finally restart apache2 to se the correct update status on Drupal.

cristian100’s picture

Issue summary: View changes

#2 worked for me for a VPS Centos

phayes’s picture

I just thought I would mention here that you do not *need* GEOS to run GeoPHP. Everything should run just fine without it. It's only required if you need some of the special functions it provides or want a performance boost.

florisg’s picture

Status: Active » Needs review

Fixed this issue in Ubuntu 14.04, same procedure should apply to all Debian/Ubuntu (BOA)
Note: in latest boa 2.3.8 _PHP_GEOS=YES option in .barracuda.cnf works fine.

Found a nice up to date repo in git:
git clone https://github.com/libgeos/libgeos geos
In order to add the library post install with BOA multi php be sure to edit the Makefile.am and adjust paths accordingly

PHP = /opt/php53/bin/php
PHP_CONFIG = /opt/php53/bin/php-config

Then run:

./autogen.sh
./configure --enable-php
#if no checkinstall is on the system
sudo apt-get install checkinstall
# continue
sudo checkinstall
\"GEOS 3.4.2 with PHP bindings.\"
# set verson to something starting with a integer i.e. 3.4.2
# friendly script asks questions n,y

Finally add geos.so to either /opt/php53/etc/php.ini or to another shared ini extension location.

; GEOS extension
extension=geos.so

Then reload FPM53
sudo service php53-fpm reload
In the logs php logs a source error appears

[date] PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/php53/lib/php/extensions/no-debug-non-zts-20090626/geos.so' - /opt/php53/lib/php/extensions/no-debug-non-zts-20090626/geos.so: undefined symbol: zend_new_interned_string in Unknown on line 0

This means that the Makefile needs more .c dependencies to work with php build.

NOTE: Do not attempt to install php unit testing from apt, it automatically installs appache2 and breaks your setup.

Reis Quarteu’s picture

Hi.

I followed all the kind instructions I can find in the comments, but none seem to work for me. :(

I google a little, found the following resources, but none of them seems to work either:

* https://github.com/phayes/geoPHP/wiki/Geos-installation-on-centos6
* http://duntuk.com/how-install-geos-centos
* http://stackoverflow.com/questions/22695685/installing-geophp-with-geos-...
* https://geophp.net/geos.html

I'm using PHP 5.4.38, Zend Engine v2.4.0, ionCube PHP Loader v4.6.1, Zend Guard Loader v3.3, and CentOS 6.6.

Any help will be greatly appreciated.

Many thanks in advance! :)

deanflory’s picture

This below worked on CentOS 6.6 on 2015-07-31 with everything updated and resulted in a Drupal 7.38 cron run showing GEOS is installed on the Status Report page:

Via Terminal:

yum install gcc gcc-c++
svn checkout http://svn.osgeo.org/geos/trunk geos-svn
cd geos-svn
./autogen.sh
./configure
./configure --enable-php && make clean && make
make check
make install

Check it's properly installed:
geos-config --version

3.5.0dev

The last thing to enable the GEOS extension in PHP is to create a /etc/php5/conf.d/geos.ini file with the following content:
OR using WHM > Service Configuration > PHP Configuration Editor > Advanced Mode > Core > extension > geos.so

; GEOS extension
extension=geos.so

Restart your server.

Log back in via SSH and check that it's still installed and recognized:
geos-config --version

Run cron on your Drupal site and you should receive:

GeoPHP and GEOS GEOS PHP extension Installed

Reis Quarteu’s picture

Hi.

Just want to say that GEOS has been working perfectly since some time after my previous comment. It seems Drupal needs some time to make sure GEOS is correctly installed on the server.

Best regards to all! :)

pedrosp’s picture

Version: 7.x-1.4 » 7.x-1.x-dev

Updating to PHP7 with Ubuntu 16.04 LTS

apt-get update
apt-get install libgeos-dev php7.0-dev
cd /root
git clone https://git.osgeo.org/gogs/geos/php-geos.git
cd php-geos
./autogen.sh
./configure
make 
make install

add to php.ini
extensions=geos.so
service php-fpm restart

Donit’s picture

Editing php.ini didn't worked out for me. I needed to create an additional geos.ini-file. My steps:

apt-get update
apt-get install libgeos-dev php7.1-dev
cd /root
git clone https://git.osgeo.org/gogs/geos/php-geos.git
cd php-geos
./autogen.sh
./configure
make 
make install
geos-config --version
nano /etc/php/7.1/fpm/conf.d/geos.ini
; GEOS extension
extension=geos.so

Save and exit.

service php7.1-fpm restart
service nginx restart

Flush the caches. Check the Status report; GEOS should be installed.

Joel MMCC’s picture

Are there any good Drupal-optimized hosting services (shared, grid, cloud, or VPS) that have GEOS already installed?

Donit’s picture

@Joel It won't be preinstalled on regular shared hosting (at least, I've never seen this). You can ask Drupal-specialized hosts like Acquia, Platform.sh and Pantheon if they have GEOS installed. On cloud and VPS, you have to do it yourself. You can easily do this by following the steps above (you just may want to adjust the used PHP-Version, if you use another one).

WJNLLC’s picture

Joel MMCC’s picture

Anyone know of a way to install GEOS on an Aqcuia Development Desktop 2 for Windows installation?

frogdog_tech’s picture

#27 bingo! cheers.

erwangel’s picture

#28 done it for Debian 9 (stretch)! same as #27 with better detailed steps to php.ini. Thank you pedrosp and Donit!
Just adjust script for your php version if you are not in 7.1; mine was 7.0 (see #30)

denix’s picture

FileSize
21.86 KB

If anyone is interested in php8.0 here is a little patch, thanks to Remi Collet and @Donit

apt-get update
apt-get install libgeos-dev php8.0-dev
git clone https://git.osgeo.org/gogs/geos/php-geos.git
cd php-geos
./autogen.sh
./configure
make 
make install
geos-config --version
echo "extension=geos.so" >/etc/php/8.0/fpm/conf.d/geos.ini

or, if you are using Lando (or Docker), add these lines:

- /bin/sh -c 'cp /app/geos.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/geos.so'
- docker-php-ext-enable geos

where /app/geos.so is you compiled binary (you can also compile it directly in lando)

steinmb’s picture

Status: Needs review » Fixed

Consider this support req. answered.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.