DDEV users periodically ask if they can use a specific PHP patch version with their projects, either to test/compare for a particular bug or to match a production version exactly.
This experimental add-on tries to address that need, although there are a number of caveats:
- The build done using this process uses the technique from static-php-cli and full details are available there. It supports all the versions supported in the upstream repository, currently PHP 7.3-8.4.
- The build does not match the build done using the official DDEV php packages (which actually come from deb.sury.org.
- It currently does not provide xdebug, see extension support.
- The resultant PHP binaries built here do not have the exact same extensions as the official DDEV PHP binaries.
- Building the binaries happens in the build phase of
ddev start
, and it takes a long time on the firstddev start
or whenever you change versions. My tests on Gitpod, with a great internet connection, took about 8-9 minutes. It can be really annoying, and a better way to build would be an improvement. - If you want to see the build process as it proceeds, you can use
ddev debug refresh
orDDEV_VERBOSE=true ddev start
. - When you use this add-on, your DDEV
php_version
setting is ignored. - To see what's going on during the build, use
ddev debug rebuild -s web --cache
- Your mileage may vary.
- The static-php-ci repository provides a relatively easy way to build static PHP binaries (the CLI and
php-fpm
) which can be used to replace the ones installed inddev-webserver
. - The provided Dockerfile.php-patch-build does the building.
- The provided
config.php-patch-build
provides post-start hooks that install the built binaries.
ddev add-on get rfay/ddev-php-patch-build
ddev restart
You can choose a different PHP version, the command below creates a .ddev/.env.php-patch-build
file that you can commit:
ddev dotenv set .ddev/.env.php-patch-build --static-php-version=8.0.10
ddev add-on get rfay/ddev-php-patch-build
ddev restart
config.php-yaml
Dockerfile.php-patch-build
- A test suite in test.bats that makes sure the service continues to work as expected.
- Github actions setup so that the tests run automatically when you push to the repository.
Contributed and maintained by @rfay