New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No preferable way to install custom extension that is not mentioned in default list. #77

Closed
ephrin opened this Issue Mar 26, 2015 · 25 comments

Comments

Projects
None yet
@ephrin

ephrin commented Mar 26, 2015

1st problem: docker-php-ext-* does not provide a way to install extension package from pecl (for example i need to install ext-mongo which cause me to make some tricks with Dockerfile to succeed)
2nd problem: custom source extensions (e.g. phalcon) that has to be compiled from scratch and exposed to runnin php daemon (fpm, apache).

Is there any instructions to make it right and simple? For any of cases.

Thanks.

@sazo

This comment has been minimized.

Show comment
Hide comment
@sazo

sazo Mar 29, 2015

+1 got the same problem installing xdebug.
I ended up installing git via apt-get and clone xdebug repos into /usr/src/php/ext/ and then use docker-php-ext-install xdebug.
Worked like a charm.

sazo commented Mar 29, 2015

+1 got the same problem installing xdebug.
I ended up installing git via apt-get and clone xdebug repos into /usr/src/php/ext/ and then use docker-php-ext-install xdebug.
Worked like a charm.

@jaredm4

This comment has been minimized.

Show comment
Hide comment
@jaredm4

jaredm4 Apr 2, 2015

Contributor

While we could add a docker-php-pecl-* type script, it wouldn't save you any effort. It's still a simple one liner in your Dockerfile to do it currently.

Installing php-redis and xdebug:

RUN pecl install -o -f redis xdebug \
    && rm -rf /tmp/pear \
    && echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini \
    && echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so" > /usr/local/etc/php/conf.d/xdebug.ini \

If we did make a script, it really would just automate the last portion of my paste above.

Contributor

jaredm4 commented Apr 2, 2015

While we could add a docker-php-pecl-* type script, it wouldn't save you any effort. It's still a simple one liner in your Dockerfile to do it currently.

Installing php-redis and xdebug:

RUN pecl install -o -f redis xdebug \
    && rm -rf /tmp/pear \
    && echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini \
    && echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so" > /usr/local/etc/php/conf.d/xdebug.ini \

If we did make a script, it really would just automate the last portion of my paste above.

@ephrin

This comment has been minimized.

Show comment
Hide comment
@ephrin

ephrin Apr 16, 2015

thanks.
the issue could be closed?
or we could really make the issue as one_line_install_specific_extension_from_pecl_script job?

ephrin commented Apr 16, 2015

thanks.
the issue could be closed?
or we could really make the issue as one_line_install_specific_extension_from_pecl_script job?

@kojiromike

This comment has been minimized.

Show comment
Hide comment
@kojiromike

kojiromike May 4, 2015

@jaredm4 it might not save much effort, but it would simplify things for users expecting a consistent interface for installing extensions.

kojiromike commented May 4, 2015

@jaredm4 it might not save much effort, but it would simplify things for users expecting a consistent interface for installing extensions.

@captn3m0

This comment has been minimized.

Show comment
Hide comment
@captn3m0

captn3m0 Jul 2, 2015

To install xdebug from source, I used this (found this issue later)

cd
curl "http://xdebug.org/files/xdebug-2.3.3.tgz" -o xdebug.tar.gz
cd xdebug-2.3.3
phpize
./configure --enable-xdebug --with-php-config=/usr/local/bin/php-config
echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"' > /usr/local/etc/php/conf.d/xdebug.ini

captn3m0 commented Jul 2, 2015

To install xdebug from source, I used this (found this issue later)

cd
curl "http://xdebug.org/files/xdebug-2.3.3.tgz" -o xdebug.tar.gz
cd xdebug-2.3.3
phpize
./configure --enable-xdebug --with-php-config=/usr/local/bin/php-config
echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"' > /usr/local/etc/php/conf.d/xdebug.ini
@starikovs

This comment has been minimized.

Show comment
Hide comment
@starikovs

starikovs Jul 12, 2015

@jaredm4, thanks for your answer. I'm looking for a way of installing php-redis and I have a few questions. Do I need to install any dependencies before installing redis that way (I use FROM php:fpm)? and do I need to install pecl or it's already included? Thanks.

starikovs commented Jul 12, 2015

@jaredm4, thanks for your answer. I'm looking for a way of installing php-redis and I have a few questions. Do I need to install any dependencies before installing redis that way (I use FROM php:fpm)? and do I need to install pecl or it's already included? Thanks.

@helderco

This comment has been minimized.

Show comment
Hide comment
@helderco

helderco Jul 12, 2015

As mentioned on #115, I use my own docker-php-pecl-install script.

I like the reduced boilerplate:

FROM php:5.6-fpm
COPY docker-php-pecl-install /usr/local/bin/
RUN docker-php-pecl-install xdebug-2.3.3 uploadprogress-1.0.3.1 redis-2.2.5

helderco commented Jul 12, 2015

As mentioned on #115, I use my own docker-php-pecl-install script.

I like the reduced boilerplate:

FROM php:5.6-fpm
COPY docker-php-pecl-install /usr/local/bin/
RUN docker-php-pecl-install xdebug-2.3.3 uploadprogress-1.0.3.1 redis-2.2.5
@jjelev

This comment has been minimized.

Show comment
Hide comment
@jjelev

jjelev Jul 14, 2015

@lazycommit did you install mongo successfully?

RUN pecl install mongo
ADD mongo.ini /usr/local/etc/php/conf.d/

mongo.ini:

extension=mongo.so

Doesn't work for me on php:5.6-fpm

jjelev commented Jul 14, 2015

@lazycommit did you install mongo successfully?

RUN pecl install mongo
ADD mongo.ini /usr/local/etc/php/conf.d/

mongo.ini:

extension=mongo.so

Doesn't work for me on php:5.6-fpm

@j16sdiz

This comment has been minimized.

Show comment
Hide comment
@j16sdiz

j16sdiz Aug 4, 2015

Need a docker-php-pecl-install script.
The example have "magic" constant like "no-debug-non-zts-20121212". Would be great if the installer script can handle that without hardcoding.

j16sdiz commented Aug 4, 2015

Need a docker-php-pecl-install script.
The example have "magic" constant like "no-debug-non-zts-20121212". Would be great if the installer script can handle that without hardcoding.

@helderco

This comment has been minimized.

Show comment
Hide comment
@helderco

helderco Aug 4, 2015

@j16sdiz have you tried mine?

helderco commented Aug 4, 2015

@j16sdiz have you tried mine?

@starikovs

This comment has been minimized.

Show comment
Hide comment
@starikovs

starikovs Aug 4, 2015

BTW, I installed php-redis extension this way:

RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/2.2.7.tar.gz \
    && tar xfz /tmp/redis.tar.gz \
    && rm -r /tmp/redis.tar.gz \
    && mv phpredis-2.2.7 /usr/src/php/ext/redis \
    && docker-php-ext-install redis

I think any other php extension can be installed the same way and without PECL which I don't have by default in ubuntu.

Details is here http://stackoverflow.com/a/31623759/202550

starikovs commented Aug 4, 2015

BTW, I installed php-redis extension this way:

RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/2.2.7.tar.gz \
    && tar xfz /tmp/redis.tar.gz \
    && rm -r /tmp/redis.tar.gz \
    && mv phpredis-2.2.7 /usr/src/php/ext/redis \
    && docker-php-ext-install redis

I think any other php extension can be installed the same way and without PECL which I don't have by default in ubuntu.

Details is here http://stackoverflow.com/a/31623759/202550

@rainbow-alex

This comment has been minimized.

Show comment
Hide comment
@rainbow-alex

rainbow-alex Sep 18, 2015

Failed loading /usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so:  /usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so: cannot open shared object file: No such file or directory

@ephrin please add that one_line_install_specific_extension_from_pecl_script :)

rainbow-alex commented Sep 18, 2015

Failed loading /usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so:  /usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so: cannot open shared object file: No such file or directory

@ephrin please add that one_line_install_specific_extension_from_pecl_script :)

@roelvanduijnhoven

This comment has been minimized.

Show comment
Hide comment
@roelvanduijnhoven

roelvanduijnhoven Sep 28, 2015

Got the same error when I tried this. You finally nailed it @rainbow-alex ? If so: got any hint on how to fix this?

roelvanduijnhoven commented Sep 28, 2015

Got the same error when I tried this. You finally nailed it @rainbow-alex ? If so: got any hint on how to fix this?

@jaredm4

This comment has been minimized.

Show comment
Hide comment
@jaredm4

jaredm4 Sep 28, 2015

Contributor

@roelvanduijnhoven @rainbow-alex More than likely, the folder name changed. Go to /usr/local/lib/php/extensions/ after installing xdebug, take note of the new folder name containing xdebug, and install it like I pasted above (without that custom script).

Contributor

jaredm4 commented Sep 28, 2015

@roelvanduijnhoven @rainbow-alex More than likely, the folder name changed. Go to /usr/local/lib/php/extensions/ after installing xdebug, take note of the new folder name containing xdebug, and install it like I pasted above (without that custom script).

@roelvanduijnhoven

This comment has been minimized.

Show comment
Hide comment
@roelvanduijnhoven

roelvanduijnhoven Sep 29, 2015

Thanks. That solved it.

@rainbow-alex If you install xdebug directly on the container it will tell what the filename is. Thus docker run pecl install -o -f xdebug will yield the correct path on the console.

roelvanduijnhoven commented Sep 29, 2015

Thanks. That solved it.

@rainbow-alex If you install xdebug directly on the container it will tell what the filename is. Thus docker run pecl install -o -f xdebug will yield the correct path on the console.

@jaredm4

This comment has been minimized.

Show comment
Hide comment
@jaredm4

jaredm4 Sep 29, 2015

Contributor

Granted, not a good solution as it prevents the Dockerfile from being portable. A pecl install script would be nice, that could determine that path when installing and prevent that issue.

Contributor

jaredm4 commented Sep 29, 2015

Granted, not a good solution as it prevents the Dockerfile from being portable. A pecl install script would be nice, that could determine that path when installing and prevent that issue.

@ephrin

This comment has been minimized.

Show comment
Hide comment
@ephrin

ephrin Dec 18, 2015

@rainbow-alex not topical anymore. Pecl installs normally and existent scripts are good as is to enable an extension.
For more diving into the issue (and some mixin of extension installation flags issue) there are two variants of feature todos:
a) implement some script (interceptor) for pecl to be able to pass config flags for its prompt;
or (as the replacement of ugly a.:)
b) use pecl or natively make a download of extension to be able to pass flags to ./configure by docker-php-ext-* scripts as already provided.

**For inspiration look into phpbrew :)

ephrin commented Dec 18, 2015

@rainbow-alex not topical anymore. Pecl installs normally and existent scripts are good as is to enable an extension.
For more diving into the issue (and some mixin of extension installation flags issue) there are two variants of feature todos:
a) implement some script (interceptor) for pecl to be able to pass config flags for its prompt;
or (as the replacement of ugly a.:)
b) use pecl or natively make a download of extension to be able to pass flags to ./configure by docker-php-ext-* scripts as already provided.

**For inspiration look into phpbrew :)

@luiscoms

This comment has been minimized.

Show comment
Hide comment
@luiscoms

luiscoms Dec 30, 2015

Add in your Dockerfile

# Enable and configure xdebug
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug

Reference: http://stackoverflow.com/questions/30594804/

luiscoms commented Dec 30, 2015

Add in your Dockerfile

# Enable and configure xdebug
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug

Reference: http://stackoverflow.com/questions/30594804/

@ekandreas

This comment has been minimized.

Show comment
Hide comment
@ekandreas

ekandreas Jan 4, 2016

This doesn't work with php:7.0.1-apache:

RUN pecl install xdebug && \
         docker-php-ext-enable xdebug

I think that xdebug is in some kind of beta right now for PHP7. Correct?

ekandreas commented Jan 4, 2016

This doesn't work with php:7.0.1-apache:

RUN pecl install xdebug && \
         docker-php-ext-enable xdebug

I think that xdebug is in some kind of beta right now for PHP7. Correct?

@yosifkit

This comment has been minimized.

Show comment
Hide comment
@yosifkit

yosifkit Jan 6, 2016

Member

Looks like it still is just a release candidate:

[2015-12-12] - Xdebug 2.4.0RC3 is out!

This is the third release candidate of the 2.4 series. The 2.4 series adds support for PHP 7
http://xdebug.org/

Member

yosifkit commented Jan 6, 2016

Looks like it still is just a release candidate:

[2015-12-12] - Xdebug 2.4.0RC3 is out!

This is the third release candidate of the 2.4 series. The 2.4 series adds support for PHP 7
http://xdebug.org/

@ekandreas

This comment has been minimized.

Show comment
Hide comment
@ekandreas

ekandreas Jan 6, 2016

'''
RUN pecl install xdebug-beta &&
docker-php-ext-enable xdebug
'''

ekandreas commented Jan 6, 2016

'''
RUN pecl install xdebug-beta &&
docker-php-ext-enable xdebug
'''

@awh6al

This comment has been minimized.

Show comment
Hide comment
@awh6al

awh6al Jan 7, 2016

thank you @ekandreas 👍

awh6al commented Jan 7, 2016

thank you @ekandreas 👍

@GuillaumeSeren

This comment has been minimized.

Show comment
Hide comment
@GuillaumeSeren

GuillaumeSeren Mar 17, 2016

This works great, thanks @luiscoms

# Enable and configure xdebug
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug

GuillaumeSeren commented Mar 17, 2016

This works great, thanks @luiscoms

# Enable and configure xdebug
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug
@tianon

This comment has been minimized.

Show comment
Hide comment
@tianon

tianon Aug 29, 2016

Member

Thanks for all the discussion and useful information! I'm closing since there's nothing to change in the image (given that the existing scripts handle this reasonably well), but this thread should serve as a useful reference for folks looking for help doing this kind of thing in the future. 👍

Member

tianon commented Aug 29, 2016

Thanks for all the discussion and useful information! I'm closing since there's nothing to change in the image (given that the existing scripts handle this reasonably well), but this thread should serve as a useful reference for folks looking for help doing this kind of thing in the future. 👍

@tianon tianon closed this Aug 29, 2016

@ztwo79

This comment has been minimized.

Show comment
Hide comment
@ztwo79

ztwo79 Oct 25, 2016

I have a project using old mongo extension which is deprecated . Unable to install by pecl. Got a error message "No releases for package "pecl/mongo" exist" when I tried to install mongo extension by running
pecl install mongo
I end up install mongo extension manually. Below is work for me.
RUN apt-get update \
&& apt-get -y install libssl-dev \
&& curl -L -o /tmp/mongo.tar.gz https://github.com/mongodb/mongo-php-driver-legacy/archive/1.6.14.tar.gz \
&& tar xfz /tmp/mongo.tar.gz -C /tmp/ \
&& mkdir -p /usr/src/php/ext/mongo \
&& mv /tmp/mongo-php-driver-legacy-1.6.14/* /usr/src/php/ext/mongo \
&& rm -r /tmp/mongo.tar.gz /tmp/mongo-php-driver-legacy-1.6.14 \
&& cd /usr/src/php/ext/mongo \
&& phpize \
&& ./configure \
&& make all \
&& docker-php-ext-install mongo\
&& docker-php-ext-enable mongo\

ztwo79 commented Oct 25, 2016

I have a project using old mongo extension which is deprecated . Unable to install by pecl. Got a error message "No releases for package "pecl/mongo" exist" when I tried to install mongo extension by running
pecl install mongo
I end up install mongo extension manually. Below is work for me.
RUN apt-get update \
&& apt-get -y install libssl-dev \
&& curl -L -o /tmp/mongo.tar.gz https://github.com/mongodb/mongo-php-driver-legacy/archive/1.6.14.tar.gz \
&& tar xfz /tmp/mongo.tar.gz -C /tmp/ \
&& mkdir -p /usr/src/php/ext/mongo \
&& mv /tmp/mongo-php-driver-legacy-1.6.14/* /usr/src/php/ext/mongo \
&& rm -r /tmp/mongo.tar.gz /tmp/mongo-php-driver-legacy-1.6.14 \
&& cd /usr/src/php/ext/mongo \
&& phpize \
&& ./configure \
&& make all \
&& docker-php-ext-install mongo\
&& docker-php-ext-enable mongo\

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