I'm not familiar with Suhosin (never used it) but if possible I need to check using PHP whether it is installed. This is for part of an installer that I'm writing. Thanks.
+2
A:
extension_loaded('suhosin');
PHP docs for extension_loaded
.
If the extension doesn't load, it may still be available through dl
:
if (!extension_loaded('suhosin')) {
if (!dl('suhosin.so')) {
// Extension not loaded.
return false;
}
}
// Extension loaded.
return true;
strager
2010-08-01 22:39:03
This will not work if you compiled suhosin as a part of your PHP interpreter. Installing as the extension in not the only way of installation. http://www.hardened-php.net/suhosin/how_to_install_or_upgrade.html
netme
2010-08-01 23:02:20
@netme, I wasn't aware of this, sorry.
strager
2010-08-01 23:14:28
+2
A:
I found only that there is the way to determine it - to put phpinfo() output to variable and to check Suhosin keywords:
<?php
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
if (strpos($phpinfo, "Suhosin") !== FALSE)
echo "Installed";
?>
netme
2010-08-01 23:00:44
A:
You can test if a configuration open is set for Suhosin:
$isSuhosinInstalled = ini_get('suhosin.session.max_id_length') !== '';
strager
2010-08-01 23:15:14
This will not work on all systems with Suhosin installed too. On many systems Suhosin is unconfigured by default. I tried on my 2 hostings, on both variables were not initialized.
netme
2010-08-02 06:21:37
@netme, Odd; I thought PHP filled in the default value if it was missing from the actual configuration files. Oh well.
strager
2010-08-02 11:37:34