docker-php-extension-installer/scripts/check-installed-extension.php
Michele Locati 25a58a500f
Add support to UOPZ
uopz disables exit() by default, so we can't assume that exit()
will actually quit a PHP script
2019-09-27 17:48:22 +02:00

25 lines
623 B
PHP

<?php
$extension = isset($argv[1]) ? trim($argv[1]) : '';
$rc = 1;
if ($extension === '') {
fprintf(STDERR, "Missing module handle.\n");
} else {
$nameMap = array(
'opcache' => 'Zend OPcache',
);
$extensionLowerCase = strtolower($extension);
if (isset($nameMap[$extensionLowerCase])) {
$extension = $nameMap[$extensionLowerCase];
}
if (!extension_loaded($extension)) {
fprintf(STDERR, sprintf("Extension not loaded: %s\n", $extension));
} else {
fprintf(STDOUT, sprintf("Extension correctly loaded: %s\n", $extension));
$rc = 0;
}
}
exit($rc);