找到可用的(未加载)PHP扩展 [英] Locate available (not loaded) PHP extensions

查看:103
本文介绍了找到可用的(未加载)PHP扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法来查找所有可用的PHP扩展是否已加载.我查看了如何查看PHP加载的扩展? /a>,但仅说明如何查找已加载的扩展名.我也想找到卸载的扩展程序.

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 how to find loaded extensions. I want a way to find unloaded extensions also.

从php.ini中知道了extension_dir,我做了一个ls /extension_dir/*.so,它返回了26个条目.当我尝试使用php -m时,我得到了57个条目.怎么可能?

Knowing the extension_dir from php.ini I did a ls /extension_dir/*.so which returned 26 entries. When I tried with php -m, I got 57 entries. How is it possible?

我如何知道可以加载哪些PHP扩展?我不想知道哪些已加载,但哪些是 loadable .

How do I know which PHP extensions are available to be loaded? I don't want to know which are loaded but which are loadable.

推荐答案

如果要获取可能可加载的扩展名列表,则应获取扩展名等于PHP_SHLIB_SUFFIX值的文件列表.在PHP检查PHP扩展名(<install-dir>/lib/php/extensions/<debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO)的目录中.如果要避免已加载的扩展名,则应将扩展名(不带文件扩展名)传递给

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 (<install-dir>/lib/php/extensions/<debug-or-not>-<zts-or-not>-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().

请记住,具有正确文件扩展名的文件无法从PHP作为扩展名加载,因为该文件的结构不正确(例如,由于文件已损坏),或者因为PHP扩展名取决于文件扩展程序找不到或无法加载.

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.

这篇关于找到可用的(未加载)PHP扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆