note 129849 added to function.extension-loaded
| From: | seb.gibbs@ymail.com | Date: | Tue, 12 Nov 2024 03:10:45 +0000 |
| Subject: | note 129849 added to function.extension-loaded | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221646@lists.php.net to get a copy of this message | ||
// Checks php extension, output any warnings
// For applications that requires certain extensions
function checkExtension($mod, $use = '', $warn = false, $fix = true) {
if (empty($mod)) return false;
if (extension_loaded($mod)) return true;
$out = 'Please enable '.$mod.' : '.$use.'<br>';
if ($fix) {
if (function_exists("dl")) {
$ok = @dl($mod);
if ($ok) $out .= 'Extension temporary enabled'; else $out .= 'Unable to start the
extension';
} else {
$out .= 'Unable to internally started any extension';
}
}
if ($warn) {
echo '<span class="error">'. $out .'</span><br>';
}
}
// examples
checkExtension('','used to access email',true,true);
checkExtension('imap','used to access email',true,true);
checkExtension('iconv','used in mail decoding',true,true);
checkExtension('curl','curl used to get some https content',true,true);
checkExtension('zip','used to send zip data',true,true);
checkExtension('zlib','gzopen used to unzip downloads',true,true);
checkExtension('openssl','allows https with file_get_contents and
fopen',true,true);
checkExtension('sockets','low level sockets',true,true);
checkExtension('mysqli','to access database',true,true);
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 58.96.37.13)
----
Manual Page -- https://php.net/manual/en/function.extension-loaded.php
Edit -- https://main.php.net/note/edit/129849
Del: integrated -- https://main.php.net/note/delete/129849/integrated
Del: useless -- https://main.php.net/note/delete/129849/useless
Del: bad code -- https://main.php.net/note/delete/129849/bad+code
Del: spam -- https://main.php.net/note/delete/129849/spam
Del: non-english -- https://main.php.net/note/delete/129849/non-english
Del: in docs -- https://main.php.net/note/delete/129849/in+docs
Del: other reasons-- https://main.php.net/note/delete/129849
Reject -- https://main.php.net/note/reject/129849
Search -- https://main.php.net/manage/user-notes.php