diff --git a/README.md b/README.md index c0bba20..06c3fab 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,10 @@ Five different images for each PHP Version: | Version | Latest Version | Monthly Builds | Alpine Version | |:----------:|:----------------:|:--------------:|:----------------:| -| **8.6** ⚠ | **8.6.0beta2** | **yes** | **edge/testing** | -| **8.5** | **8.5.10** | **yes** | **edge** | -| **8.4** | **8.4.25** | **yes** | **edge** | -| **8.3** | **8.3.33** | **yes** | **edge** | +| **8.6** ⚠ | **8.6.0rc2** | **yes** | **edge/testing** | +| **8.5** | **8.5.11** | **yes** | **edge** | +| **8.4** | **8.4.26** | **yes** | **edge** | +| **8.3** | **8.3.35** | **yes** | **edge** | | 8.2 | 8.2.31 | - | 3.22 | | 8.1 | 8.1.31 | - | 3.19 | | 8.0 | 8.0.30 | - | 3.16 | @@ -82,9 +82,10 @@ Five different images for each PHP Version: | 7.0 | 7.0.33 | - | 3.5 | | 5.6 | 5.6.40 | - | 3.8 | -⚠ PHP 8.6 is a **pre-release** (beta). The images are meant for early testing only and do not -ship the `redis`, `memcached` and `yaml` extensions yet, since Alpine has not published them for -PHP 8.6. +⚠ PHP 8.6 is a **pre-release** (release candidate). The images are meant for early testing only. Alpine has not +published `imagick`, `memcached` and `yaml` for PHP 8.6 yet, so these three are built from their +upstream git repositories until it does. `imagick` is shipped disabled; see +[Imagick on PHP 8.6](docs/dockerfile.md#imagick-on-php-86). :::info PHP versions with monthly builds receive regular updates. Legacy versions (without monthly builds) are no longer supported. diff --git a/assets/index.html b/assets/index.html index a52d66d..e74cad4 100644 --- a/assets/index.html +++ b/assets/index.html @@ -120,11 +120,9 @@

Pre-installed Extensio
gettext
iconv
igbinary
-
imagick
intl
json
mbstring
-
mcrypt
memcached
mongodb
mysqli
diff --git a/config/php-8.2.yml b/config/php-8.2.yml index 17f2ba3..de22c76 100644 --- a/config/php-8.2.yml +++ b/config/php-8.2.yml @@ -36,8 +36,7 @@ extensions: - pdo_pgsql - pdo_sqlite - pear -# - pecl-imagick - - pecl-mcrypt +# imagick: not bundled. Install when needed: apk add php82-pecl-imagick - pecl-memcached - pecl-mongodb - pecl-xdebug diff --git a/config/php-8.3.yml b/config/php-8.3.yml index 88c1c0a..ca68aa8 100644 --- a/config/php-8.3.yml +++ b/config/php-8.3.yml @@ -36,8 +36,7 @@ extensions: - pdo_pgsql - pdo_sqlite - pear -# - pecl-imagick - - pecl-mcrypt +# imagick: not bundled. Install when needed: apk add php83-pecl-imagick - pecl-memcached - pecl-mongodb - pecl-xdebug diff --git a/config/php-8.4.yml b/config/php-8.4.yml index bcd5271..f3ed116 100644 --- a/config/php-8.4.yml +++ b/config/php-8.4.yml @@ -36,8 +36,7 @@ extensions: - pdo_pgsql - pdo_sqlite - pear -# - pecl-imagick -# - pecl-mcrypt +# imagick: not bundled. Install when needed: apk add php84-pecl-imagick - pecl-memcached - pecl-mongodb - pecl-xdebug diff --git a/config/php-8.5.yml b/config/php-8.5.yml index 4c92dec..5e7a8d7 100644 --- a/config/php-8.5.yml +++ b/config/php-8.5.yml @@ -28,7 +28,7 @@ extensions: - mysqli - mysqlnd - openssl -# - opcache +# opcache: built into the PHP binary since 8.5, no package needed - pcntl - pdo - pdo_dblib @@ -36,8 +36,7 @@ extensions: - pdo_pgsql - pdo_sqlite - pear -# - pecl-imagick -# - pecl-mcrypt +# imagick: not bundled. Install when needed: apk add php85-pecl-imagick - pecl-memcached - pecl-mongodb - pecl-xdebug diff --git a/config/php-8.6.yml b/config/php-8.6.yml index 76efa17..9950309 100644 --- a/config/php-8.6.yml +++ b/config/php-8.6.yml @@ -28,7 +28,7 @@ extensions: - mysqli - mysqlnd - openssl -# - opcache +# opcache: built into the PHP binary since 8.5, no package needed - pcntl - pdo - pdo_dblib @@ -36,8 +36,7 @@ extensions: - pdo_pgsql - pdo_sqlite - pear -# - pecl-imagick -# - pecl-mcrypt +# imagick: see the `pecl` section below (compiled but not enabled) # - pecl-memcached - pecl-mongodb - pecl-xdebug @@ -65,6 +64,35 @@ pecl: zend: True config: - xdebug.remote_port=9001 + # The extensions below have no Alpine package for PHP 8.6 yet, and their latest pecl.php.net + # releases do not build on PHP 8.6 (XtOffsetOf / zval_dtor removed); the fix is only in git. + # Temporary: remove each entry and enable the matching `pecl-*` in `extensions` once Alpine + # publishes php86-pecl-imagick, php86-pecl-memcached and php86-pecl-yaml. + # imagick is only compiled, not enabled: the ImageMagick runtime is too large to ship by default. + # To use it: apk add imagemagick && echo "extension=imagick.so" > /etc/php86/conf.d/imagick.ini + - name: imagick + enable: False + source: + repository: https://github.com/Imagick/imagick.git + reference: 55ed2e9fda264395636a2e27e51f31673f5566ab + buildPackages: + - imagemagick-dev + - name: memcached + source: + repository: https://github.com/php-memcached-dev/php-memcached.git + reference: 0b52d3657140750fa0eddd20cdbfc6edc8fbdadd + buildPackages: + - libmemcached-dev + packages: + - libmemcached-libs + - name: yaml + source: + repository: https://github.com/php/pecl-file_formats-yaml.git + reference: a7a3b8680b8fbf0895fd63371a0ffc1305b1a5b8 + buildPackages: + - yaml-dev + packages: + - yaml composer: packages: diff --git a/docs/building.md b/docs/building.md index ee0506a..3303f75 100644 --- a/docs/building.md +++ b/docs/building.md @@ -141,9 +141,18 @@ pecl: - name: xdebug # required version: 2.5.5 # optional - if not set, get the latest install: False # optional - do not call pecl install + enable: False # optional - do not create the .ini file; the extension + # is left in the image but not loaded zend: True # optional - if true, add as zend extension config: # optional - if set, add extra config to php.ini - xdebug.remote_port=9001 # for this extension + source: # optional - build from a git repository instead of + repository: https://...git # downloading the release from pecl.php.net + reference: (COMMIT/TAG) # optional - if not set, use the default branch + buildPackages: # optional - temporary packages needed only to build + - (NAME) # this extension + packages: # optional - permanent packages this extension needs + - (NAME) # at runtime # Composer packages to be installed composer: @@ -157,12 +166,14 @@ composer: - phpbcbf - phpmd -# Temporary packages to be used to build the PECL packages +# Temporary packages to be used to build the PECL packages (generic; packages needed +# by a single extension go in `pecl[].buildPackages`) peclBuildPackages: - autoconf - build-base -# Permanent packages to be installed in the image +# Permanent packages to be installed in the image (generic; packages needed +# by a single extension go in `pecl[].packages`) additionalPackages: - libssl1.1 - libcrypto1.1 diff --git a/docs/dockerfile.md b/docs/dockerfile.md index 743c48f..99d36f8 100644 --- a/docs/dockerfile.md +++ b/docs/dockerfile.md @@ -71,11 +71,7 @@ FROM byjg/php:8.3-cli # Switch to root to install packages USER root -RUN apk add --no-cache imagemagick imagemagick-dev - -# Install PHP extensions if needed -RUN pecl install imagick && \ - echo "extension=imagick.so" > /etc/php/conf.d/imagick.ini +RUN apk add --no-cache php83-pecl-imagick # Switch back to app user USER app @@ -91,6 +87,21 @@ RUN composer install --no-dev --optimize-autoloader Always switch back to the `app` user after installing packages. Running your application as root negates security benefits. ::: +#### Imagick on PHP 8.6 + +The PHP 8.6 images already contain a compiled `imagick.so`, but it is not enabled and the +ImageMagick runtime is not installed. There is nothing to compile; install the runtime and +enable the extension: + +```dockerfile title="Dockerfile" +FROM byjg/php:8.6-cli + +USER root +RUN apk add --no-cache imagemagick && \ + echo "extension=imagick.so" > /etc/php86/conf.d/imagick.ini +USER app +``` + ### Full Configuration Example ```dockerfile title="Dockerfile" @@ -150,7 +161,6 @@ ENV PHP_CONTROLLER=/index.php # ENV DISABLEMODULE_msgpack=1 # ENV DISABLEMODULE_xdebug=1 # ENV DISABLEMODULE_yaml=1 -# ENV DISABLEMODULE_mcrypt=1 # ENV DISABLEMODULE_mongodb=1 # Copy application with proper ownership diff --git a/docs/image-base.md b/docs/image-base.md index e1aff90..35e4c48 100644 --- a/docs/image-base.md +++ b/docs/image-base.md @@ -17,7 +17,7 @@ All base images come with over 45 PHP extensions pre-installed: ``` bcmath, Core, ctype, curl, date, dba, dom, exif, fileinfo, filter, ftp, gd, gettext, -hash, iconv, igbinary, intl, json, libxml, mbstring, mcrypt, memcached, mongodb, +hash, iconv, igbinary, intl, json, libxml, mbstring, memcached, mongodb, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, pdo_mysql, pdo_pgsql, pdo_sqlite, Phar, posix, readline, redis, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, tokenizer, xdebug, xml, xmlreader, xmlwriter, diff --git a/docs/security.md b/docs/security.md index 1f3f12c..a5d6f57 100644 --- a/docs/security.md +++ b/docs/security.md @@ -158,7 +158,7 @@ To balance security with stability: ### Why Edge/Testing for PHP 8.6? -PHP 8.6 has not been released yet — Alpine ships it as `8.6.0_betaX` in the `edge/testing` +PHP 8.6 has not been released yet — Alpine ships it as `8.6.0_rcX` in the `edge/testing` repository, which is the only Alpine repository carrying PHP 8.6 packages. **Do not use PHP 8.6 in production** until it reaches a stable release. These images exist for: @@ -166,8 +166,11 @@ repository, which is the only Alpine repository carrying PHP 8.6 packages. - Early adoption and compatibility testing - Previewing upcoming PHP features -Because PHP 8.6 is only available in `edge/testing`, a few extensions are **not** bundled in the -8.6 images yet: `redis`, `memcached` and `yaml`. They are added as soon as Alpine publishes them. +Because PHP 8.6 is only available in `edge/testing`, Alpine has not published every extension +for it yet. `imagick`, `memcached` and `yaml` are built from a pinned commit of their upstream +git repositories (see `pecl[].source` in `config/php-8.6.yml`), since their latest PECL releases +do not compile on PHP 8.6. They are replaced by the Alpine packages as soon as those are published. +`imagick` is compiled but not enabled; see [Imagick on PHP 8.6](dockerfile.md#imagick-on-php-86). ### Legacy PHP Versions (8.1 and older) diff --git a/templates/php-base.j2 b/templates/php-base.j2 index 138df4f..ea914db 100644 --- a/templates/php-base.j2 +++ b/templates/php-base.j2 @@ -7,12 +7,14 @@ apk --no-cache {% for rep in repositories %}--repository {{ rep }} {% endfor %} mkdir -p /etc/php/conf.d # Install PECL and additional packages -apk --no-cache {% for rep in repositories %}--repository {{ rep }} {% endfor %} add {% for pkg in additionalPackages %}{{ pkg }} {% endfor %} -apk --no-cache {% for rep in repositories %}--repository {{ rep }} {% endfor %} add --virtual .build php{{ version.suffix }}-pear php{{ version.suffix }}-dev {% for pkg in peclBuildPackages %}{{ pkg }} {% endfor %} +apk --no-cache {% for rep in repositories %}--repository {{ rep }} {% endfor %} add {% for pkg in additionalPackages %}{{ pkg }} {% endfor %}{% for ext in pecl %}{% for pkg in ext.packages | default([]) %}{{ pkg }} {% endfor %}{% endfor %} +apk --no-cache {% for rep in repositories %}--repository {{ rep }} {% endfor %} add --virtual .build php{{ version.suffix }}-pear php{{ version.suffix }}-dev {% for pkg in peclBuildPackages %}{{ pkg }} {% endfor %}{% for ext in pecl %}{% for pkg in ext.buildPackages | default([]) %}{{ pkg }} {% endfor %}{% endfor %} sed -ie "s/ -n / /" /usr/bin/pecl {% for ext in pecl -%} -{% if ext.install is not defined or ext.install %}yes "" | pecl install {{ ext.name }}{% if ext.version is defined %}-{{ ext.version }}{% endif %}{% endif %} -printf "{% if ext.zend %}zend_{% endif %}extension={{ ext.name }}.so{% for config in ext.config %}\n{{ config }}{% endfor %}\n" > /etc/php{{ version.suffix }}/conf.d/{{ ext.name }}.ini +{% if ext.install is not defined or ext.install %}{% if ext.source is defined %}git clone -q {{ ext.source.repository }} /tmp/pecl-{{ ext.name }} +(cd /tmp/pecl-{{ ext.name }} && git checkout -q {{ ext.source.reference | default('HEAD') }} && yes "" | pecl install package.xml) +rm -rf /tmp/pecl-{{ ext.name }}{% else %}yes "" | pecl install {{ ext.name }}{% if ext.version is defined %}-{{ ext.version }}{% endif %}{% endif %}{% endif %} +{% if ext.enable is not defined or ext.enable %}printf "{% if ext.zend %}zend_{% endif %}extension={{ ext.name }}.so{% for config in ext.config %}\n{{ config }}{% endfor %}\n" > /etc/php{{ version.suffix }}/conf.d/{{ ext.name }}.ini{% endif %} {% endfor %} apk del --no-cache .build