Run update.sh

This commit is contained in:
Docker Library Bot 2019-12-03 22:12:31 +00:00
parent af0f5cf03f
commit 9299493658
1 changed files with 17 additions and 14 deletions

View File

@ -95,7 +95,7 @@ WARNING:
PHP is a server-side scripting language designed for web development, but which can also be used as a general-purpose programming language. PHP can be added to straight HTML or it can be used with a variety of templating engines and web frameworks. PHP code is usually processed by an interpreter, which is either implemented as a native module on the web-server or as a common gateway interface (CGI). PHP is a server-side scripting language designed for web development, but which can also be used as a general-purpose programming language. PHP can be added to straight HTML or it can be used with a variety of templating engines and web frameworks. PHP code is usually processed by an interpreter, which is either implemented as a native module on the web-server or as a common gateway interface (CGI).
> [wikipedia.org/wiki/PHP](http://en.wikipedia.org/wiki/PHP) > [wikipedia.org/wiki/PHP](https://en.wikipedia.org/wiki/PHP)
![logo](https://raw.githubusercontent.com/docker-library/docs/01c12653951b2fe592c1f93a13b4e289ada0e3a1/php/logo.png) ![logo](https://raw.githubusercontent.com/docker-library/docs/01c12653951b2fe592c1f93a13b4e289ada0e3a1/php/logo.png)
@ -104,7 +104,7 @@ PHP is a server-side scripting language designed for web development, but which
### Create a `Dockerfile` in your PHP project ### Create a `Dockerfile` in your PHP project
```dockerfile ```dockerfile
FROM php:7.2-cli FROM php:7.4-cli
COPY . /usr/src/myapp COPY . /usr/src/myapp
WORKDIR /usr/src/myapp WORKDIR /usr/src/myapp
CMD [ "php", "./your-script.php" ] CMD [ "php", "./your-script.php" ]
@ -122,7 +122,7 @@ $ docker run -it --rm --name my-running-app my-php-app
For many simple, single file projects, you may find it inconvenient to write a complete `Dockerfile`. In such cases, you can run a PHP script by using the PHP Docker image directly: For many simple, single file projects, you may find it inconvenient to write a complete `Dockerfile`. In such cases, you can run a PHP script by using the PHP Docker image directly:
```console ```console
$ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7.2-cli php your-script.php $ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7.4-cli php your-script.php
``` ```
## How to install more PHP extensions ## How to install more PHP extensions
@ -134,7 +134,7 @@ We provide the helper scripts `docker-php-ext-configure`, `docker-php-ext-instal
In order to keep the images smaller, PHP's source is kept in a compressed tar file. To facilitate linking of PHP's source with any extension, we also provide the helper script `docker-php-source` to easily extract the tar or delete the extracted source. Note: if you do use `docker-php-source` to extract the source, be sure to delete it in the same layer of the docker image. In order to keep the images smaller, PHP's source is kept in a compressed tar file. To facilitate linking of PHP's source with any extension, we also provide the helper script `docker-php-source` to easily extract the tar or delete the extracted source. Note: if you do use `docker-php-source` to extract the source, be sure to delete it in the same layer of the docker image.
```Dockerfile ```Dockerfile
FROM php:7.2-cli FROM php:7.4-cli
RUN docker-php-source extract \ RUN docker-php-source extract \
# do important things \ # do important things \
&& docker-php-source delete && docker-php-source delete
@ -142,16 +142,15 @@ RUN docker-php-source extract \
### PHP Core Extensions ### PHP Core Extensions
For example, if you want to have a PHP-FPM image with `iconv` 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 `gd` extensions, you can inherit the base image that you like, and write your own `Dockerfile` like this:
```dockerfile ```dockerfile
FROM php:7.2-fpm FROM php:7.4-fpm
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 \
libpng-dev \ libpng-dev \
&& docker-php-ext-install -j$(nproc) iconv \ && docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd && docker-php-ext-install -j$(nproc) gd
``` ```
@ -159,14 +158,18 @@ Remember, you must install dependencies for your extensions manually. If an exte
See ["Dockerizing Compiled Software"](https://tianon.xyz/post/2017/12/26/dockerize-compiled-software.html) for a description of the technique Tianon uses for determining the necessary build-time dependencies for any bit of software (which applies directly to compiling PHP extensions). See ["Dockerizing Compiled Software"](https://tianon.xyz/post/2017/12/26/dockerize-compiled-software.html) for a description of the technique Tianon uses for determining the necessary build-time dependencies for any bit of software (which applies directly to compiling PHP extensions).
### Default extensions
Some extensions are compiled by default. This depends on the PHP version you are using. Run `php -m` in the container to get a list for your specific version.
### PECL extensions ### 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: 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:7.2-cli FROM php:7.4-cli
RUN pecl install redis-4.0.1 \ RUN pecl install redis-5.1.1 \
&& pecl install xdebug-2.6.0 \ && pecl install xdebug-2.8.1 \
&& docker-php-ext-enable redis xdebug && docker-php-ext-enable redis xdebug
``` ```
@ -179,11 +182,11 @@ RUN apt-get update && apt-get install -y libmemcached-dev zlib1g-dev \
It is *strongly* recommended that users use an explicit version number in their `pecl install` invocations to ensure proper PHP version compatibility (PECL does not check the PHP version compatiblity when choosing a version of the extension to install, but does when trying to install it). It is *strongly* recommended that users use an explicit version number in their `pecl install` invocations to ensure proper PHP version compatibility (PECL does not check the PHP version compatiblity when choosing a version of the extension to install, but does when trying to install it).
For example, `memcached-2.2.0` has no PHP version constraints (https://pecl.php.net/package/memcached/2.2.0), but `memcached-3.0.4` requires PHP 7.0.0 or newer (https://pecl.php.net/package/memcached/3.0.4). When doing `pecl install memcached` (no specific version) on PHP 5.6, PECL will try to install the latest release and fail. For example, `memcached-2.2.0` has no PHP version constraints (https://pecl.php.net/package/memcached/2.2.0), but `memcached-3.1.4` requires PHP 7.0.0 or newer (https://pecl.php.net/package/memcached/3.1.4). When doing `pecl install memcached` (no specific version) on PHP 5.6, PECL will try to install the latest release and fail.
Beyond the compatibility issue, it's also a good practice to ensure you know when your dependencies receive updates and can control those updates directly. Beyond the compatibility issue, it's also a good practice to ensure you know when your dependencies receive updates and can control those updates directly.
Unlike PHP core extensions, PECL extensions should be installed in series to fail properly if something went wrong. Otherwise errors are just skipped by PECL. For example, `pecl install memcached-2.2.0 && pecl install redis-2.2.8` instead of `pecl install memcached-2.2.0 redis-2.2.8`. However, `docker-php-ext-enable memcached redis` is fine to be all in one command. Unlike PHP core extensions, PECL extensions should be installed in series to fail properly if something went wrong. Otherwise errors are just skipped by PECL. For example, `pecl install memcached-3.1.4 && pecl install redis-5.1.1` instead of `pecl install memcached-3.1.4 redis-5.1.1`. However, `docker-php-ext-enable memcached redis` is fine to be all in one command.
### Other extensions ### Other extensions
@ -252,7 +255,7 @@ The default config can be customized by copying configuration files into the `$P
### Example ### Example
```dockerfile ```dockerfile
FROM php:7.2-fpm-alpine FROM php:7.4-fpm-alpine
# Use the default production configuration # Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"