PHP 8.5: New PHP_BUILD_PROVIDER constant

Version8.5
TypeNew Feature

PHP 8.5 introduces a new global PHP constant named PHP_BUILD_PROVIDER, which contains the PHP_BUILD_PROVIDER environment variable set at build time. The contents of the environment variable is arbitrary, but it is meant to be used at the PHP build step to add some contextual information about the build provider.

If the PHP_BUILD_PROVIDER environment variable was not set at build-time, the PHP_BUILD_PROVIDER is not declared.

This information is already available in phpinfo() output under `Build provider", but prior to PHP 8.5, this information was not exposed as a PHP constant.

Declaring PHP_BUILD_PROVIDER value

To declare the PHP_BUILD_PROVIDER PHP constant, set an environment variable with the same name prior to calling ./configure script.

  ./buildconf
+ export PHP_BUILD_PROVIDER="Example Value"
  ./configure ...
  make
  make install
echo PHP_BUILD_PROVIDER;
// "Example Value"

Backward Compatibility Impact

The PHP_BUILD_PROVIDER PHP constant is a new constant added in PHP 8.5.

In PHP 8.5 and older versions, declaring a PHP_BUILD_PROVIDER environment variable carried this information to the phpinfo() output as Build provider. PHP 8.5 and later can retrieve this information directly by checking whether the PHP_BUILD_PROVIDER constant is declared and resolving the constant.


PHP_BUILD_PROVIDER Implementation