-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
The PHP version check in config.m4 yields an
if test -z "$PHP_MONGODB_PHP_VERSION"; then if test -z "$PHP_CONFIG"; then AC_MSG_ERROR([php-config not found]) fi PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version` PHP_MONGODB_PHP_VERSION_ID=`echo "${PHP_MONGODB_PHP_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'` fi AC_MSG_RESULT($PHP_MONGODB_PHP_VERSION) if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70200"; then AC_MSG_ERROR([not supported. Need a PHP version >= 7.2.0 (found $PHP_MONGODB_PHP_VERSION)]) fi
When running configure on php:8.1-alpine, the following output is observed:
checking PHP version... 8.1.22 sh: out of range checking whether to enable developer build flags... no
The "out of range" error likely originates from the test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70200" statement, and suggests that PHP_MONGODB_PHP_VERSION_ID is not computed correctly by the awk one-liner above.
Note: after investigating this further, we determined that the problem is not related to the awk one-liner. Rather, PHP Docker images for Alpine happen to define PHP_VERSION in their shell, but not PHP_VERSION_ID. The conditional in our config.m4 assumed that PHP_VERSION_ID would be defined alongside PHP_VERSION, which is typically only the case when doing a static build of PHP, since those values are derived from php-src's configure.ac.
The fix entailed changing the logic to always derive PHP_VERSION and PHP_VERSION_ID from php-config, as is done in other extensions (e.g. xdebug, parallel).
- related to
-
PHPC-2382 Allow building the extension statically with php-src
- Closed