Warm tip: This article is reproduced from serverfault.com, please click

check for required php-extensions

发布于 2013-11-15 10:45:33

I was asking myself if it is possible to check php files for required extensions like php-gd or php-xml. I'd like to identify all prerequisites to run a certain script.

I hope anyone can help.

Thanks in advance.

Best regards, christian

Questioner
john.dough
Viewed
11
BenM 2013-11-15 18:47:43

You can use extension_loaded:

if(extension_loaded('gd'))
{
    echo 'GD Library found';
}

Alternatively, you can use get_loaded_extensions(), which will return an array.