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
|
||||
|
||||
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:
|
||||
|
||||
```dockerfile
|
||||
FROM php:5.6-fpm
|
||||
# Install modules
|
||||
FROM php:5-fpm
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libmcrypt-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-install gd
|
||||
CMD ["php-fpm"]
|
||||
&& docker-php-ext-install -j$(nproc) gd
|
||||
```
|
||||
|
||||
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
|
||||
Some "extension" are in reality [PECL](https://pecl.php.net/) extension. To install a pecl extension you need to do this (for memcached) :
|
||||
#### PECL extensions
|
||||
|
||||
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
|
||||
FROM php:5.6-fpm
|
||||
# Install pecl extension
|
||||
RUN apt-get update && apt-get install -y libmemcached-dev && pecl install memcached
|
||||
CMD ["php-fpm"]
|
||||
FROM php:5-fpm
|
||||
RUN apt-get update && apt-get install -y libmemcached-dev \
|
||||
&& pecl install memcached \
|
||||
&& 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`
|
||||
|
|
|
|||
Loading…
Reference in New Issue