Skip to content

Add description for docker-php-ext-install #130

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

Merged
merged 4 commits into from
Jan 19, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions php/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ same commands to build and run:
Where `src/` is the directory containing all your php code and `config/`
contains your `php.ini` file.

### How to install more PHP extensions

We provide two convenient scripts named `docker-php-ext-configure` and `docker-php-ext-install`, you can use them to
easily install PHP extension.

For example, if you want to have a PHP-FPM image with `iconv`, `mcrypt` and `gd`
extensions, you can inheriting the base image that you like, and write your own
`Dockerfile` like this:

FROM php:5.5-fpm
# Install modules
RUN apt-get update && apt-get install -y \
libmcrypt-dev libpng12-dev libfreetype6-dev libjpeg62-turbo-dev \
&& docker-php-ext-install iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-gd-dir=/usr/include/ \
&& docker-php-ext-install gd
CMD ["php-fpm"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be inherited from the base image, won't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following simple example works well for me (to get both gd and mcrypt):

FROM php:5.6-fpm
RUN apt-get update && apt-get install -y \
        libpng12-dev \
        libmcrypt-dev \
    && docker-php-ext-install gd mcrypt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example is using php 5.5, which is probably more common than @tianon's example with 5.6 (since it is still quite new).

We should minimally change to php:5.5-fpm so that it does not have to be updated quite as often, rather than the 5.5.19-fpm which is already out of date.

Also, libjpeg9 (plus dev and dbg versions) does not exist in debian:jessie; it has been replaced by libjpeg62-turbo. Does it really need all those dependencies to build and later run? Can we simplify it like @tianon's example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

I keep getting errors like 403 Forbidden [IP: 193.140.100.100 80], can't test it now.


Remember, you must install dependencies for your extensions manually. If an extension needs custom `configure` arguments,
you can use the `docker-php-ext-configure` script like this example.

### Without a `Dockerfile`

If you don't want to include a `Dockerfile` in your project, it is sufficient to
Expand Down