Skip to content

Instantly share code, notes, and snippets.

@dwayneparton
Created April 28, 2021 20:49
Show Gist options
  • Save dwayneparton/8aefce55d8d2e95e01c30d1f7ad2358b to your computer and use it in GitHub Desktop.
Save dwayneparton/8aefce55d8d2e95e01c30d1f7ad2358b to your computer and use it in GitHub Desktop.
How to install PHP GEOS on php/wordpress docker image
FROM wordpress:latest
RUN apt-get update
# Install Libgeos
RUN apt-get install -y libgeos-dev
# Install PHP GEOS
RUN curl -fsSL 'https://git.osgeo.org/gitea/geos/php-geos/archive/master.tar.gz' -o php-geos.tar.gz \
&& mkdir -p /tmp/php-geos \
&& tar -xf php-geos.tar.gz -C /tmp/php-geos --strip-components=1 \
&& rm php-geos.tar.gz \
&& docker-php-ext-configure /tmp/php-geos --enable-geos \
&& docker-php-ext-install /tmp/php-geos \
&& rm -r /tmp/php-geos
@dwayneparton
Copy link
Author

This can also be written something like:

RUN curl -fsSL 'https://git.osgeo.org/gitea/geos/php-geos/archive/master.tar.gz' -o php-geos.tar.gz \
	&& mkdir -p php-geos \
	&& tar -xf php-geos.tar.gz -C php-geos --strip-components=1 \
	&& rm php-geos.tar.gz \
	&& ( \
		cd php-geos \
		&& phpize \
		&& ./configure --enable-geos \
		&& make -j "$(nproc)" \
		&& make install \
	) \
	&& rm -r php-geos \
	&& docker-php-ext-enable geos

@alex-moon
Copy link

Need to update the cURL URL:

RUN curl -fsSL 'https://github.com/libgeos/php-geos/tarball/master' -o php-geos.tar.gz \
	&& mkdir -p /tmp/php-geos \
	&& tar -xf php-geos.tar.gz -C /tmp/php-geos --strip-components=1 \
	&& rm php-geos.tar.gz \
	&& docker-php-ext-configure /tmp/php-geos --enable-geos \
	&& docker-php-ext-install /tmp/php-geos \
	&& rm -r /tmp/php-geos

@dwayneparton
Copy link
Author

@alex-moon There doesn't seem to be any active development going on at that repo(https://github.com/libgeos/php-geos/). Not sure if it is still active?

@alex-moon
Copy link

@alex-moon There doesn't seem to be any active development going on at that repo(https://github.com/libgeos/php-geos/). Not sure if it is still active?

Damn you're right. It looks like libgeos.org links to this repo: https://git.osgeo.org/gitea/geos/php-geos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment