Fix whitespace and update examples and organization
This commit is contained in:
parent
4c2af775a8
commit
e216e2f546
|
|
@ -66,34 +66,56 @@ Where `src/` is the directory containing all your php code and `config/` contain
|
||||||
|
|
||||||
### How to install more PHP extensions
|
### 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.
|
We provide the helper scripts `docker-php-ext-configure`, `docker-php-ext-install`, and `docker-php-ext-enable` to more easily install PHP extensions.
|
||||||
|
|
||||||
|
#### PHP Core Extensions
|
||||||
|
|
||||||
For example, if you want to have a PHP-FPM image with `iconv`, `mcrypt` and `gd` extensions, you can inherit the base image that you like, and write your own `Dockerfile` like this:
|
For example, if you want to have a PHP-FPM image with `iconv`, `mcrypt` and `gd` extensions, you can inherit the base image that you like, and write your own `Dockerfile` like this:
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
FROM php:5.6-fpm
|
FROM php:5-fpm
|
||||||
# Install modules
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
libfreetype6-dev \
|
libfreetype6-dev \
|
||||||
libjpeg62-turbo-dev \
|
libjpeg62-turbo-dev \
|
||||||
libmcrypt-dev \
|
libmcrypt-dev \
|
||||||
libpng12-dev \
|
libpng12-dev \
|
||||||
&& docker-php-ext-install iconv mcrypt \
|
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
|
||||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||||
&& docker-php-ext-install gd
|
&& docker-php-ext-install -j$(nproc) gd
|
||||||
CMD ["php-fpm"]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
### How to install PECL extensions
|
#### PECL extensions
|
||||||
Some "extension" are in reality [PECL](https://pecl.php.net/) extension. To install a pecl extension you need to do this (for memcached) :
|
|
||||||
|
Some extensions are not provided with the PHP source, but are instead available through [PECL](https://pecl.php.net/). To install a PECL extension, use `pecl install` to download and compile it, then use `docker-php-ext-enable` to enable it:
|
||||||
|
|
||||||
```dockerfile
|
```dockerfile
|
||||||
FROM php:5.6-fpm
|
FROM php:5-fpm
|
||||||
# Install pecl extension
|
RUN apt-get update && apt-get install -y libmemcached-dev \
|
||||||
RUN apt-get update && apt-get install -y libmemcached-dev && pecl install memcached
|
&& pecl install memcached \
|
||||||
CMD ["php-fpm"]
|
&& docker-php-ext-enable memcached
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Other extensions
|
||||||
|
|
||||||
|
Some extensions are not provided via either Core or PECL; these can be installed too, although the process is less automated:
|
||||||
|
|
||||||
|
```dockerfile
|
||||||
|
FROM php:5-apache
|
||||||
|
RUN curl -fsSL 'https://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz' -o xcache.tar.gz \
|
||||||
|
&& mkdir -p xcache \
|
||||||
|
&& tar -xf xcache.tar.gz -C xcache --strip-components=1 \
|
||||||
|
&& rm xcache.tar.gz \
|
||||||
|
&& ( \
|
||||||
|
cd xcache \
|
||||||
|
&& phpize \
|
||||||
|
&& ./configure --enable-xcache \
|
||||||
|
&& make -j$(nproc) \
|
||||||
|
&& make install \
|
||||||
|
) \
|
||||||
|
&& rm -r xcache \
|
||||||
|
&& docker-php-ext-enable xcache
|
||||||
```
|
```
|
||||||
|
|
||||||
### Without a `Dockerfile`
|
### Without a `Dockerfile`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue