Solr + PHP7.2 in docker

1,014 views
Skip to first unread message

sant...@cyberpuerta.mx

unread,
Sep 11, 2018, 12:42:23 PM9/11/18
to Apache Solr PHP Extension
Hello, I am trying to install the solr extension in php using pecl inside a Dockerfile.

If I try with php 7.0 it works fine, but with php 7.2 the installation fails.

There are many people on the internet that say the issue has been solved but I don't know where to access that solved package of solr.

Here is a Dockerfile that works:

FROM php:7.0

RUN apt-get update \
&& apt-get install -y libcurl4-openssl-dev libxml2-dev \
&& pecl install solr-2.4.0 \
&& docker-php-ext-enable solr

Then you can check in a container from this Dockerfile that solr is in deed enabled.

But just change to using php:7.2 and docker fails to build:

FROM php:7.2

RUN apt-get update \
&& apt-get install -y libcurl4-openssl-dev libxml2-dev \
&& pecl install solr-2.4.0 \
&& docker-php-ext-enable solr


This is not a docker issue, i is an issue with php7.2 and this solr extension. I do need this to work with docker in a Dockerfile, so the flexibility that I have for fiddling with the pecl package contents is minimal.

Has anybody been succesful installing solr extension in php 7.2 with a docker-friendly script?

Thanks for your help,
Santiago

sant...@cyberpuerta.mx

unread,
Sep 11, 2018, 2:01:24 PM9/11/18
to Apache Solr PHP Extension
Ok, I found that in the official repo of this extension the change is already on the master branch.
This works for me in the mean time while they publish the updated extension:

FROM php:7.2

RUN apt-get update \

RUN apt-get update \
 && apt-get install -y libcurl4-openssl-dev libxml2-dev git \
  && cd pecl-search_engine-solr \
  && /usr/local/bin/phpize && ./configure && make && make install \
  && cd .. && rm -rf pecl-search_engine-solr \
  && apt-get remove --purge -y git \
  && rm -r /var/lib/apt/lists/* \
  && docker-php-ext-enable solr

I hope this helps someone out there.

Also, if you have something to add or to suggest to my workaround please do
Reply all
Reply to author
Forward
Message has been deleted
0 new messages