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.
Asked
Active
Viewed 1.9k times
4 Answers
20
To detect the Suhosin Extension use extension_loaded() no matter if it is dynamically loaded or statically compiled:
extension_loaded('suhosin');
To detect the Suhosin-Patch, check for the constant presence:
constant("SUHOSIN_PATCH");

Seldaek
- 40,986
- 9
- 97
- 77

Mikhail Chernykh
- 2,659
- 22
- 15
7
simply write a php file in your document root like <?php phpinfo(); ?>
it will print all the information related to php installation just find for the "suhosin" block in it is installed on your server you can find the block with all the values set for it.

Pankaj Khairnar
- 3,028
- 3
- 25
- 34
-
suhosin show up in php info if it was included as PHP extension – Sergey Korzhov May 03 '19 at 13:03
3
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
- 88,763
- 26
- 134
- 176
-
3This 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 – Mikhail Chernykh Aug 01 '10 at 23:02
-
2
You can test if a configuration open is set for Suhosin:
$isSuhosinInstalled = ini_get('suhosin.session.max_id_length') !== '';

strager
- 88,763
- 26
- 134
- 176
-
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. – Mikhail Chernykh Aug 02 '10 at 06:21
-
@netme, Odd; I thought PHP filled in the default value if it was missing from the actual configuration files. Oh well. – strager Aug 02 '10 at 11:37