如何查看 PHP 加载的扩展?
它一定在 phpinfo() 转储中的某个地方,但我只是不知道在哪里。 它应该位于“附加模块”部分下吗? 别的地方? 我试图找出为什么某些扩展似乎没有加载,但我什至不知道应该在哪里查找。
It's got to be somewhere in the phpinfo() dump, but I just don't know where. Is it supposed to be under the "Additional Modules" section? Somewhere else? I'm trying to figure out why some extensions don't appear to be loaded, but I don't even know where I should be looking.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
跑步
will give you all the modules, and
will give you a lot more detailed information on what the current configuration.
Running
will give you all the modules, and
will give you a lot more detailed information on what the current configuration.
运行命令。 您将获得已安装的扩展:
或运行此命令以获取所有模块的安装和卸载版本
Run command. You will get installed extentions:
Or run this command to get all module install and uninstall with version
使用
get_loaded_extensions()
PHP函数use
get_loaded_extensions()
PHP function您想要
在命令行上
运行:或者如果您有权打开服务器配置文件
并查看所有扩展,
您甚至可以通过在“开”和“关”之间切换来启用或禁用它们,如下所示
You want to run:
on the command line,
or if you have access to the server configuration file open
and look at all the the extensions,
you can even enable or disable them by switching between On and Off like this
如果您想测试是否加载了特定扩展,您还可以使用
extension_loaded
函数,请参阅文档 此处If you want to test if a particular extension is loaded you can also use the
extension_loaded
function, see documentation here我遇到了同样的问题,我需要知道安装了哪些模块及其版本。 目前,我的解决方案是让 PHP 从命令行告诉我。 请注意,“核心”是 PHP。
输出:
I was having the same issue, I needed to know what modules were installed and their version. For now, my solution is to have PHP tell me from the command line. Note, "Core" is PHP.
Output:
get_loaded_extensions()
输出扩展列表。phpinfo(INFO_MODULES);
输出扩展及其详细信息。get_loaded_extensions()
output the extensions list.phpinfo(INFO_MODULES);
output the extensions and their details.您询问在 phpinfo() 输出中在哪里看到加载的扩展。
答案:
它们作为单独的部分/表格在底部列出,并且仅在加载时列出。
这是加载扩展 Curl 的示例。
<强>... <强>...
>
我在 Linux Debian 上安装了它
You asked where do you see loaded extensions in phpinfo() output.
Answer:
They are listed towards the bottom as separate sections/tables and ONLY if they are loaded.
Here is an example of extension Curl loaded.
...
...
I installed it on Linux Debian with
您可以通过以下命令查看 PHP 安装的所有扩展
-Debian/Ubuntu
-RHEL/CentOS
-Fedora 22+
You can see all extensions install by PHP by this
-Debian/Ubuntu
-RHEL/CentOS
-Fedora 22+
您在寻找特定的扩展吗? 在
phpinfo();
中,只需在网络浏览器中按 Ctrl+F,输入您的扩展名的前 3-4 个字母正在寻找,它应该显示它是否已加载。通常在 phpinfo() 中,它不会在一个位置显示所有加载的扩展,它为每个加载的扩展都有一个单独的部分,其中显示其所有变量、文件路径等,因此如果您的扩展名没有任何部分,则可能意味着它尚未加载。
或者,您可以打开 php.ini 文件并使用 Ctrl+F 方法查找您的扩展名,并查看其是否已被注释掉(通常在开头附近添加分号)线)。
Are you looking for a particular extension? In your
phpinfo();
, just hit Ctrl+F in your web browser, type in the first 3-4 letters of the extension you're looking for, and it should show you whether or not its loaded.Usually in
phpinfo()
it doesn't show you all the loaded extensions in one location, it has got a separate section for each loaded extension where it shows all of its variables, file paths, etc, so if there is no section for your extension name it probably means it isn't loaded.Alternatively you can open your php.ini file and use the Ctrl+F method to find your extension, and see if its been commented out (usually by a semicolon near the start of the line).