Locate available (not loaded) PHP extensions

后端 未结 3 941
再見小時候
再見小時候 2021-01-17 23:26

I need a way to find all the available PHP extensions whether they are loaded or not. I looked at How do I see the extensions loaded by PHP? but it only explains h

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 00:15

    If you want the list of possibly loadable extensions, you should get the list of the files with an extension equal to the value of PHP_SHLIB_SUFFIX, and that are in the directory where PHP checks for PHP extensions (/lib/php/extensions/--ZEND_MODULE_API_NO). If you want to avoid those extensions that are already loaded, you should pass the name of the extension (without file extension) to extension_loaded().

    Keep in mind that a file with the right file extension could not be loaded from PHP as extension because the file doesn't have the right structure (for example because the file is corrupted), or because the PHP extension depends from files the extension doesn't find, or it is not able to load.

提交回复
热议问题