Files
cloud-apache-container/scripts/lsphp-src-probe.php
T

47 lines
2.9 KiB
PHP
Raw Normal View History

<?php
// lsphp-src-probe.php — prints the runtime "support surface" of the PHP that
// runs it, one fact per line, for lsphp-src-overlay.sh to diff before/after the
// php.net overlay. Run under BOTH SAPIs: `bin/php probe.php` and
// `bin/lsphp probe.php` (lsphp executes a script argument under the litespeed
// SAPI — measured; it is only `-m`/`-r` it does not understand).
// Line kinds: SAPI <name> | VERSION <v> | EXT <name> <version> | ZEXT <name> <version>
// INI <name> <value> | FEAT <key> <value>
// The overlay script relies on the stable "<KIND> <key> <rest>" shape; keep it.
echo 'SAPI ', PHP_SAPI, "\n";
echo 'VERSION ', PHP_VERSION, "\n";
echo 'FEAT ZTS ', PHP_ZTS, "\n";
echo 'FEAT DEBUG ', PHP_DEBUG, "\n";
echo 'FEAT INT_SIZE ', PHP_INT_SIZE, "\n";
foreach (get_loaded_extensions() as $e) {
echo 'EXT ', str_replace(' ', '_', $e), ' ', phpversion($e), "\n";
}
foreach (get_loaded_extensions(true) as $e) {
echo 'ZEXT ', str_replace(' ', '_', $e), ' ', phpversion($e), "\n";
}
foreach (ini_get_all(null, false) as $k => $v) {
echo 'INI ', $k, ' ', var_export($v, true), "\n";
}
if (function_exists('gd_info')) {
foreach (gd_info() as $k => $v) {
echo 'FEAT gd:', str_replace(' ', '_', $k), ' ', var_export($v, true), "\n";
}
}
if (function_exists('curl_version')) {
$c = curl_version();
echo 'FEAT curl:version ', $c['version'], "\n";
echo 'FEAT curl:ssl ', $c['ssl_version'], "\n";
echo 'FEAT curl:protocols ', implode(',', $c['protocols']), "\n";
}
echo 'FEAT openssl ', defined('OPENSSL_VERSION_TEXT') ? OPENSSL_VERSION_TEXT : 'none', "\n";
if (defined('INTL_ICU_VERSION')) echo 'FEAT icu ', INTL_ICU_VERSION, "\n";
if (class_exists('Imagick')) echo 'FEAT imagick:formats ', count(Imagick::queryFormats()), "\n";
if (function_exists('sodium_crypto_aead_aes256gcm_is_available')) echo 'FEAT sodium:aes256gcm ', var_export(sodium_crypto_aead_aes256gcm_is_available(), true), "\n";
echo 'FEAT password_algos ', implode(',', password_algos()), "\n";
echo 'FEAT hash_algos ', count(hash_algos()), "\n";
echo 'FEAT stream_wrappers ', implode(',', stream_get_wrappers()), "\n";
echo 'FEAT stream_filters ', implode(',', stream_get_filters()), "\n";
if (function_exists('mb_list_encodings')) echo 'FEAT mb_encodings ', count(mb_list_encodings()), "\n";
if (function_exists('opcache_get_status')) echo 'FEAT opcache:loaded 1', "\n";
if (class_exists('Redis')) echo 'FEAT redis:serializers ', implode(',', array_filter(['IGBINARY', 'MSGPACK', 'JSON'], fn($s) => defined("Redis::SERIALIZER_$s"))), "\n";
if (class_exists('Redis')) echo 'FEAT redis:compression ', implode(',', array_filter(['LZF', 'ZSTD', 'LZ4'], fn($s) => defined("Redis::COMPRESSION_$s"))), "\n";
if (class_exists('Memcached')) echo 'FEAT memcached:igbinary ', var_export(Memcached::HAVE_IGBINARY, true), ' msgpack ', var_export(Memcached::HAVE_MSGPACK, true), ' sasl ', var_export(Memcached::HAVE_SASL, true), "\n";