When trying to build modules for PHP of different versions, at the moment of configuring the build, the latest PHP package is picked up, not the one specified in the configuration parameters.
For example.
The system has php7.4, php8.1, php8.2 installed.
./configure php --module=php7.4 --config=php-config --lib-path=/usr/lib/php/7.4/sapi
configuring PHP module
checking for PHP ... found
- PHP SAPI: [apache2handler embed cgi cli fpm]
checking for PHP version ... 8.2.12
checking for PHP embed SAPI ... found
checking for PHP Zend Thread Safety ... not found
checking for PHP zend_signal_startup() ... found
- PHP module: php7.4.unit.so
With these ./configure settings, it will still pick up the most recent package on the system, which is php8.2
Naturally, such a module does not work properly afterwards.
Forcing the default PHP interpreter to be changed to php7.4 did nothing.
Can you please tell me how to fix the problem?
System: Ubuntu 22.04.3.
Unit version 1.31.1
PHP 7.4.33
PHP 8.1.25
PHP 8.2.12