-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extensions.php
46 lines (32 loc) · 1.33 KB
/
extensions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
$sapi = \mb_strtolower(\PHP_SAPI);
$phpVariant = 'cli';
if (\strpos($sapi, 'fpm') !== false) {
$phpVariant = 'fpm';
}
if (\defined('ZEND_THREAD_SAFE') && \ZEND_THREAD_SAFE) {
$phpVariant = 'zts';
}
$phpVersion = \PHP_MAJOR_VERSION . '.' . \PHP_MINOR_VERSION;
$extensions = [
'apcu', 'bcmath', 'bz2', 'curl', 'dom', 'ftp',
'gd', 'gmp', 'gnupg', 'igbinary', 'imap', 'intl', 'ldap', 'libxml',
'mbstring', 'memcached', 'mongodb', 'msgpack', 'odbc', 'opcache', 'pcntl',
'pdo', 'pdo_mysql', 'pdo_odbc', 'pdo_pgsql', 'pdo_sqlite', 'pdo_sqlsrv',
'readline', 'simplexml', 'soap', 'sockets', 'sqlite3', 'sqlsrv', 'tidy',
'uuid', 'xml', 'xmlwriter', 'xsl', 'zip',
];
$variants = ['cli', 'fpm', 'zts'];
$versions = ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'];
$excludeExtensions = \array_fill_keys($versions,[]);
$excludeExtensions['8.4'][] = 'imagick';
$excludeExtensions['8.4'][] = 'imap';
$requiredExtensions = \array_diff($extensions, array_values($excludeExtensions[$phpVersion]));
$missingExtensions = \array_filter($requiredExtensions, static function ($extension) {
return !\extension_loaded($extension);
});
if ($missingExtensions === []) {
// All required extensions are loaded
$missingExtensions = ['mbstring'];
}
echo \implode(' ', $missingExtensions);