Skip to content

Add PHP 8.5 #180

@kaszarobert

Description

@kaszarobert

As soon as there's PHP 8.5 stable images on Dockerhub it'd be awesome if Lando could support those.

Here's an example Dockerfile where I managed to get 8.5.0RC5 working with all the extensions in Lando. Xdebug and Imagick probably still needs to be installed from source until they have a proper new compatible release.

# docker buildx build -t custom/php:8.5.0RC5-apache-bookworm .

FROM php:8.5.0RC5-apache-bookworm

ARG TARGETARCH

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN \
  # MariaDB client compatibility (https://github.com/lando/php/issues/120)
  mkdir -p /etc/apt/keyrings \
  && curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp' \
  && echo "deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://mirror.mariadb.org/repo/11.4/debian bookworm main" > /etc/apt/sources.list.d/mariadb.list

# Drupal 11 requires sqlite3 3.45+
ARG SQLITE_VERSION=3.45.1
RUN \
  curl -Lo /tmp/sqlite3.deb "https://snapshot.debian.org/archive/debian/20240506T211830Z/pool/main/s/sqlite3/sqlite3_${SQLITE_VERSION}-1_${TARGETARCH}.deb" \
  && curl -Lo /tmp/libsqlite3-0.deb "https://snapshot.debian.org/archive/debian/20240506T211830Z/pool/main/s/sqlite3/libsqlite3-0_${SQLITE_VERSION}-1_${TARGETARCH}.deb" \
  && curl -Lo /tmp/libsqlite3-dev.deb "https://snapshot.debian.org/archive/debian/20240506T211830Z/pool/main/s/sqlite3/libsqlite3-dev_${SQLITE_VERSION}-1_${TARGETARCH}.deb"

RUN \
  mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
  && apt -y update && apt-get install -y \
    default-mysql-client \
    exiftool \
    git-core \
    gnupg2 \
    imagemagick \
    mariadb-client \
    mariadb-client-compat \
    postgresql-client-15 \
    pv \
    rsync \
    ssh \
    unzip \
    wget \
    /tmp/sqlite3.deb \
    /tmp/libsqlite3-0.deb \
    /tmp/libsqlite3-dev.deb

RUN \
  install-php-extensions @fix_letsencrypt \
  && install-php-extensions apcu \
  && install-php-extensions bcmath \
  && install-php-extensions bz2 \
  && install-php-extensions calendar \
  && install-php-extensions exif \
  && install-php-extensions gd \
  && install-php-extensions gettext \
#  && install-php-extensions imagick \
  && install-php-extensions imap \
  && install-php-extensions intl \
  && install-php-extensions ldap \
  && install-php-extensions mbstring \
  && install-php-extensions memcached \
  && install-php-extensions mysqli \
  && install-php-extensions oauth \
  && install-php-extensions opcache \
  && install-php-extensions pcntl \
  && install-php-extensions pdo \
  && install-php-extensions pdo_mysql \
  && install-php-extensions pdo_pgsql \
  && install-php-extensions redis \
  && install-php-extensions soap \
  && install-php-extensions xhprof \
  && install-php-extensions zip

# Install xdebug but disable it by default
#RUN install-php-extensions xdebug \
#  && rm -f /usr/local/etc/php/conf.d/*xdebug.ini

# Install xdebug from source while there's no compatible release.
RUN git clone https://github.com/xdebug/xdebug.git \
    && cd xdebug \
    && phpize \
    && ./configure \
    && make \
    && make install \
    && cd .. \
    && docker-php-ext-enable xdebug \
    && rm -f /usr/local/etc/php/conf.d/*xdebug.ini

# Install imagick from source while there's no compatible release.
RUN apt-get update \
  && apt-get install -y libmagickwand-dev \
  && git clone https://github.com/Imagick/imagick \
  && cd imagick \
  && phpize && ./configure \
  && make \
  && make install \
  && docker-php-ext-enable imagick

RUN \
  chsh -s /bin/bash www-data && mkdir -p /var/www/.composer && chown -R www-data:www-data /var/www \
  && apt-get -y clean \
  && apt-get -y autoclean \
  && apt-get -y autoremove \
  && rm -rf /var/lib/apt/lists/* && rm -rf && rm -rf /var/lib/cache/* && rm -rf /var/lib/log/* && rm -rf /tmp/*

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions