Skip to content

Commit

Permalink
Merge pull request #767 from heroku/php84
Browse files Browse the repository at this point in the history
  • Loading branch information
dzuelke authored Dec 19, 2024
2 parents b27625c + 6a6b331 commit acbbab9
Show file tree
Hide file tree
Showing 67 changed files with 254 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Install PHP and Composer
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
php-version: "8.3"
tools: "composer:2.8"
- name: Install packages from requirements.txt, plus s5cmd (for some tests)
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/platform-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ jobs:
echo >> "$GITHUB_STEP_SUMMARY"
echo '``````markdown' >> "$GITHUB_STEP_SUMMARY" # six instead of three backticks because our output is likely to also contain series of backticks
cat php-support.md >> "$GITHUB_STEP_SUMMARY"
[[ -n "$(tail -c1 php-support.md)" ]] && echo >> "$GITHUB_STEP_SUMMARY" # add trailing newline if necessary
echo '``````' >> "$GITHUB_STEP_SUMMARY" # six instead of three backticks because our output is likely to also contain series of backticks
- name: Update Dev Center article
if: inputs.dry-run == false && inputs.update-devcenter == true
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## [Unreleased]

### ADD

- ext-blackfire/1.92.29 [David Zuelke]
- ext-pcov/1.0.12 [David Zuelke]
- PHP/8.4.1 [David Zuelke]

### CHG

- Composer/2.2.25 [David Zuelke]

## [v259] - 2024-11-21

Expand Down
4 changes: 2 additions & 2 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ composer validate --no-plugins --no-check-publish --no-check-all --quiet "$COMPO
status "Preparing platform package installation..."

if [[ $STACK == "heroku-20" ]]; then
HEROKU_PHP_DEFAULT_RUNTIME_VERSION="^7.3.0 | ^8.0.0 <8.4"
HEROKU_PHP_DEFAULT_RUNTIME_VERSION="^7.3.0 | ^8.0.0 <8.5"
else
HEROKU_PHP_DEFAULT_RUNTIME_VERSION="^8.0.0 <8.4"
HEROKU_PHP_DEFAULT_RUNTIME_VERSION="^8.0.0 <8.5"
fi
export HEROKU_PHP_DEFAULT_RUNTIME_VERSION
# extract requirements from composer.lock
Expand Down
1 change: 1 addition & 0 deletions bin/util/eol.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"8.1" => array("2023-11-25", "2025-12-31"),
"8.2" => array("2024-12-31", "2026-12-31"),
"8.3" => array("2025-12-31", "2027-12-31"),
"8.4" => array("2026-12-31", "2028-12-31"),
);

if(basename(__FILE__) != basename($_SERVER["PHP_SELF"])) return $eol; // we're being included, just return the data
Expand Down
7 changes: 7 additions & 0 deletions conf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
These folders contain run-time configs for HTTPD, Nginx and PHP.

The logic that finds these looks in the base directory first, and then traverses into sub-folders that represent specific version string parts.

This allows sharing configs between version series, but also overriding (or adding) files for more specific versions, as they take precedence.

For example, a general `php/php-fpm.conf` can be overridden for PHP 8.* by having a `php/8/php-fpm.conf`; a file that should only apply to PHP 7.3.* without overriding a "parent" could be put into `php/7/3/php-fpm.somepool.conf`.
7 changes: 7 additions & 0 deletions support/build/_conf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
These folders contain build-time configs for HTTPD and PHP.

The logic that finds these looks in the base directory first, and then traverses into sub-folders that represent specific version string parts.

This allows sharing configs between version series, but also overriding (or adding) files for more specific versions, as they take precedence.

For example, a general `php/conf.d/000-heroku.ini` can be overridden for PHP 7.* by having a `php/7/conf.d/000-heroku.ini`; a file that should only apply to PHP 8.0.* without overriding a "parent" could be put into `php/8/0/conf.d/001-foobar.ini`.
6 changes: 0 additions & 6 deletions support/build/_conf/php/5/conf.d/010-ext-zend_opcache.ini

This file was deleted.

17 changes: 0 additions & 17 deletions support/build/_conf/php/7/0/conf.d/000-heroku.ini

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
date.timezone = UTC

; we want users to see E_DEPRECATED warnings, as it's not uncommon to accidentally run PHP series newer than on local dev
error_reporting = E_ALL & ~E_STRICT
; PHP 8.4+ no longer has E_STRICT
error_reporting = E_ALL

; do not expose PHP via headers (just like we don't with web servers)
expose_php = Off
Expand Down
5 changes: 5 additions & 0 deletions support/build/_conf/php/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Our builds of PHP use the recommended `php.ini-production` file from the respective release.

These values are often different from the built-in default, and for a subset of settings, we want to override them. Examples include the default timezone (which is unset by default and in the recommended configs), errir reporting level (we want users to see deprecation warnings), or session ID length (which for legacy reasons defaults to 26 in the recommended development and production INI files, even though PHP's built-in default is 32).

Doing this using a `conf.d` file allows our settings to apply even if users bring their own "full" `php.ini` (and we can just copy these in without having to track possible upstream INI changes).
4 changes: 3 additions & 1 deletion support/build/_conf/php/conf.d/000-heroku.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ error_reporting = E_ALL & ~E_STRICT
; do not expose PHP via headers (just like we don't with web servers)
expose_php = Off

; 32 or more is recommended and always has been the default for PHP 7 on Heroku
; 32 or more is recommended and always has been the default for PHP 7+ on Heroku
; the production config we use as the baseline sets this to 26
; this setting is gone in PHP 8.4, so the more specific file for that version does not have this
session.sid_length = 32

; legacy
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions support/build/extensions/no-debug-non-zts-20180731/blackfire
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ case ${ZEND_MODULE_API_VERSION} in
20230831)
series=8.3
;;
20240924)
series=8.4
;;
*)
echo "Unsupported PHP/Zend Module API version: ${ZEND_MODULE_API_VERSION}"
exit 1
Expand Down
5 changes: 5 additions & 0 deletions support/build/extensions/no-debug-non-zts-20240924/amqp-2.1.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/amqp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/apcu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php

source $(dirname $0)/../no-debug-non-zts-20180731/blackfire
5 changes: 5 additions & 0 deletions support/build/extensions/no-debug-non-zts-20240924/ev-1.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/ev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/event
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/imagick
23 changes: 23 additions & 0 deletions support/build/extensions/no-debug-non-zts-20240924/imap
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

dep_name=$(basename $BASH_SOURCE)

# we need these libs already installed
needed=( libc-client2007e libkrb5-3 libpam0g )
missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort))
if [[ "$missing" ]]; then
echo "Error! Missing libraries: $missing"
exit 1
fi

# we need the headers for compilation
needed=( libc-client2007e-dev libkrb5-dev libpam0g-dev )
missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort))
if [[ "$missing" ]]; then
apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; }
apt-get install -q -y $missing
fi

CONFIGURE_EXTRA="--with-imap-ssl --with-kerberos"

source $(dirname $BASH_SOURCE)/../pecl
5 changes: 5 additions & 0 deletions support/build/extensions/no-debug-non-zts-20240924/imap-1.0.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20240924/imap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/memcached
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/mongodb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/oauth
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/pcov
5 changes: 5 additions & 0 deletions support/build/extensions/no-debug-non-zts-20240924/pq-2.2.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*, extensions/no-debug-non-zts-20240924/raphf-2.*

source $(dirname $0)/../no-debug-non-zts-20180731/pq
5 changes: 5 additions & 0 deletions support/build/extensions/no-debug-non-zts-20240924/psr-1.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/psr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/raphf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*, libraries/librdkafka-*

source $(dirname $0)/../no-debug-non-zts-20180731/rdkafka
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/redis
5 changes: 5 additions & 0 deletions support/build/extensions/no-debug-non-zts-20240924/uuid-1.2.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-8.4.*

source $(dirname $0)/../no-debug-non-zts-20180731/uuid
31 changes: 21 additions & 10 deletions support/build/php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ if [[ $dep_version == *alpha* ]] || [[ $dep_version == *beta* ]] || [[ $dep_vers
dep_url=https://downloads.php.net/~pierrick/${dep_archive_name}
elif [[ $dep_version == 8.3.* ]]; then
dep_url=https://downloads.php.net/~eric/${dep_archive_name}
elif [[ $dep_version == 8.4.* ]]; then
dep_url=https://downloads.php.net/~calvinb/${dep_archive_name}
fi
else
dep_url=https://www.php.net/distributions/${dep_archive_name}
Expand All @@ -40,8 +42,8 @@ curl -L ${dep_url} | tar xz

pushd ${dep_dirname}

# we need libgmp for GMP, libpam0g/libc-client for IMAP, libicu for intl, libsasl2/krb/ldap for LDAP, libreadline for PHP
needed=( libgmp10 libpam0g libc-client2007e libsasl2-2 libkrb5-3 )
# we need libgmp for GMP, libicu for intl, libsasl2/ldap for LDAP, libreadline for PHP
needed=( libgmp10 libsasl2-2 )
needed+=( libonig5 )
needed+=( libsodium23 )
if [[ $STACK == "heroku-20" ]]; then
Expand All @@ -60,14 +62,20 @@ else
needed+=( libreadline8t64 )
needed+=( libzip4t64 )
fi
if [[ $dep_version == 7.* || $dep_version == 8.[0-3].* ]]; then
needed+=( libc-client2007e libkrb5-3 libpam0g ) # the IMAP extension was bundled before PHP 8.4
fi
missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort))
if [[ "$missing" ]]; then
echo "Error! Missing libraries: $missing"
exit 1
fi

# we need libgmp-dev for GMP, libpam0g-dev/libc-client-dev for IMAP, libicu-dev for intl, libsasl2/krb5/ldap2-dev for LDAP, libreadline-dev for PHP
needed=( libgmp-dev libpam0g-dev libc-client2007e-dev libicu-dev libsasl2-dev libkrb5-dev libldap2-dev libonig-dev libreadline-dev libsodium-dev libsqlite3-dev libzip-dev libwebp-dev )
# we need libgmp-dev for GMP, libicu-dev for intl, libsasl2/ldap2-dev for LDAP, libreadline-dev for PHP
needed=( libgmp-dev libicu-dev libsasl2-dev libldap2-dev libonig-dev libreadline-dev libsodium-dev libsqlite3-dev libzip-dev libwebp-dev )
if [[ $dep_version == 7.* || $dep_version == 8.[0-3].* ]]; then
needed+=( libc-client2007e-dev libkrb5-dev libpam0g-dev ) # the IMAP extension was bundled before PHP 8.4
fi
missing=$(comm -1 -3 <(dpkg-query -W -f '${package}\n' | sort) <(IFS=$'\n'; echo "${needed[*]}" | sort))
if [[ "$missing" ]]; then
apt-get update -qq || { echo "Failed to 'apt-get update'. You must build this formula using Docker."; exit 1; }
Expand All @@ -84,10 +92,12 @@ fi

# we want to build FPM with tracing using pread, which uses /proc/$pid/mem
# depending on host/container capabilities, it will likely detect ptrace as present, but that's blocked on the platform
# the only easy way to force it to use pread is by patching configure so it assumes the ptrace check has failed
# the only easy way to force it to use pread is by patching configure to write out pread to the appropriate variable even if the ptrace check was successful
# see the AC_DEFUN([AC_FPM_TRACE] bits in sapi/fpm/config.m4
sed -i 's/have_ptrace=yes/have_ptrace=no/' configure
echo "Patching configure to force pread for PHP-FPM tracing..."
grep "fpm_trace_type=ptrace" configure && sed -i 's/fpm_trace_type=ptrace/fpm_trace_type=pread/' configure || exit 99

echo "Patching SIGTERM handling in PHP-FPM..."
if [[ $dep_version == 7.4.* ]]; then
patch -p1 < "$(dirname $BASH_SOURCE)/patches/php/7/4/ignoresigterm.patch"
elif [[ $dep_version == 7.* ]]; then
Expand All @@ -112,6 +122,10 @@ fi
if [[ $dep_version == 7.3.* ]]; then
configureopts+=("--with-libzip=/usr" "--with-onig=/usr") # PHP before 7.4 bundles these, so give explicit locations
fi
if [[ $dep_version == 7.* || $dep_version == 8.[0-3].* ]]; then
configureopts+=("--with-imap=shared" "--with-imap-ssl") # the IMAP extension was bundled before PHP 8.4
configureopts+=("--with-kerberos") # for IMAP and OpenSSL before PHP 8.4
fi

export PATH=${OUT_PREFIX}/bin:$PATH
# cannot be built shared: date, ereg, opcache (always), pcre, reflection, sockets (?), spl, standard,
Expand All @@ -127,7 +141,6 @@ export PATH=${OUT_PREFIX}/bin:$PATH
--with-pdo-mysql \
--with-mysqli \
--with-openssl \
--with-kerberos \
--with-password-argon2 \
--with-pgsql \
--with-pdo-pgsql \
Expand All @@ -140,8 +153,6 @@ export PATH=${OUT_PREFIX}/bin:$PATH
--enable-ftp=shared \
--with-gettext=shared \
--with-gmp=shared \
--with-imap=shared \
--with-imap-ssl \
--enable-intl=shared \
--with-ldap=shared \
--with-ldap-sasl \
Expand Down Expand Up @@ -218,7 +229,7 @@ if ! curl -sL https://composer.github.io/installer.sha384sum | sha384sum --quiet
exit 1
fi

php composer-setup.php --2.2 # https://github.com/composer/composer/issues/11046
php composer-setup.php

# first, read all platform packages (just "ext-" and "php-") that are already there; could be statically built, or enabled through one of the INIs loaded
platform_default=$(php composer.phar show --platform | grep -E '^(ext-\S+|php-\S+)' | sed s@^@heroku-sys/@ | tr -s " " | cut -d " " -f1,2 | sort)
Expand Down
4 changes: 0 additions & 4 deletions support/build/php-7.0.33

This file was deleted.

4 changes: 0 additions & 4 deletions support/build/php-7.1.33

This file was deleted.

4 changes: 0 additions & 4 deletions support/build/php-7.2.34

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions support/devcenter/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'8.1',
'8.2',
'8.3',
'8.4',
];
}

Expand Down
5 changes: 3 additions & 2 deletions support/installer/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "composer-plugin",
"name": "heroku/installer-plugin",
"version": "1.7.1",
"version": "1.7.2",
"autoload": {
"psr-4": {
"Heroku\\Buildpack\\PHP\\": "src/"
Expand All @@ -13,6 +13,7 @@
"plugin-modifies-install-path": true
},
"require": {
"composer-plugin-api": "^2.3.0"
"composer-plugin-api": "^2.3.0",
"php": ">=7.1"
}
}
Loading

0 comments on commit acbbab9

Please sign in to comment.