I'm trying to compile a specific version of GEOS and its PHP bindings in the Travis CI environment; they're using Ubuntu.

Here is my install script:

sudo apt-get update
sudo apt-get remove 'libgeos.*'
sudo apt-get autoremove

wget https://github.com/libgeos/libgeos/archive/$VERSION.tar.gz
tar zxf $VERSION.tar.gz
cd libgeos-$VERSION
sudo make install
cd ..

wget https://git.osgeo.org/gogs/geos/php-geos/archive/1.0.0rc1.tar.gz
tar zxf 1.0.0rc1.tar.gz
cd php-geos
mv modules/geos.so $(php-config --extension-dir)
cd ..

echo "extension=geos.so" > geos.ini
phpenv config-add geos.ini

Everything seems to compile fine, but when PHP attempts to load the GEOS extension, this message appears:

PHP Startup: Unable to load dynamic library '/home/travis/.phpenv/versions/5.6.28/lib/php/extensions/no-debug-zts-20131226/geos.so' - libgeos_c.so.1: cannot open shared object file: No such file or directory in Unknown on line 0

I've executed this command on the machine:

sudo find / -name 'libgeos_c.so*'

And here is the result:


So it looks like the freshly built GEOS PHP extension is trying to load the shared object file from another location than /usr/local/lib.

How can I fix this?

Here is the full log on Travis CI.

2 Answers 2


I did not find a way to make the extension look for the shared libraries in /usr/local/lib, but I did find a way to make libgeos install them to /usr/lib, which is where the extension is looking for them.

Just use --prefix when building libgeos:

./configure --prefix=/usr

In newer version, PHP bindings is now a standalone project, so ldconfig must be run between after build of libgeos and php-geos for PHP module to load dynamic libraries from libgeos properly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .