Running multiple PHP(-fpm) versions in parallel in DDEV web container

Viewed 111

For my open source DDEV configuration for developing TYPO3 CMS extensions (https://github.com/a-r-m-i-n/ddev-for-typo3-extensions) I would like to work with different PHP versions in different Apache VHosts.

In CLI this is easy to achieve, because every PHP binary version is present but for Apache there is always just one fpm config enabled, by default (according to configured PHP version in config.yaml).

What I tried:

  • disable php-fpm-8.0.conf
  • change sock file in pool.d/www.conf
  • restart fpm and reload apache service
  • Include php-fpm-8.0.conf in my Apache-site.conf

All within the container (to test). But the PHP version served in Apache is still 7.4.

What did I miss here? And how can I apply changes to Apache (incl. restarting) in my Webbuild/Dockerfile? Or is this the wrong place?

Thanks in advance.

1 Answers

I recommend just using a serial or parallel approach to your testing.

  1. Serial approach:
for v in 7.4 8.0. 8.1; do
  ddev config --php-version=$v
  ddev restart
  # Run tests here

Note that you can also do a nested loop where you use nginx-fpm and apache-fpm as well.

  1. Parallel approach: Have a checkout of your testbed (same code) for each PHP version (or perhaps each permutation of nginx/apache/php) and run the tests in each.

If you really want to re-architect the inside of the web container, you can in fact do it and run multiple php-fpm daemons; you could completely change the configuration with a .ddev/web-build/Dockerfile.multi-php. But this requires extensive understanding of apache configuration and is a very unusual setup, and thus compromises your testing, because your testing is now happening in an unusual situation, unlike the two suggestions above.

Related