欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > php >内容正文

php

php enable all,php中的enable_dl配置如何有用?

发布时间:2025/3/21 php 56 豆豆
生活随笔 收集整理的这篇文章主要介绍了 php enable all,php中的enable_dl配置如何有用? 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

我正在浏览php.ini,我发现以下参数enable_dl有一个奇怪的描述:

This directive is really only useful in the Apache module version of

PHP. You can turn dynamic loading of PHP extensions with dl() on and

off per virtual server or per directory.

The main reason for turning dynamic loading off is security. With

dynamic loading, it’s possible to ignore all open_basedir

restrictions. The default is to allow dynamic loading, except when

using safe mode. In safe mode, it’s always impossible to use dl().

我在apache上运行php,我很好奇这个参数究竟对我有用.上面提到的描述对我来说并不是很清楚,所以如果有人能够详细说明我会感激不尽.

解决方法:

PHP模块(扩展)只能在PHP的启动阶段加载.例如,无法使用.user.ini files加载它们.例如,extension directive仅为php.ini.

这是一个提示 – 历史上.user.ini文件不是核心,而是SAPI for Apache mod_php的每个目录.htaccess设置.

为了避免过去的这种限制,引入了dl()函数以在运行时动态加载扩展.但是只有启用,所以enable_dl指令.

但是,当前的PHP SAPI基本上禁用了对dl的支持,只能在CLI和Embed中使用它.

正如你没有说过为什么你对dl()的好奇心,我能给出的最好的答案是它只是为了深奥的原因而有用.很可能它甚至对你想要使用它的SAPI没用(你没有共享SAPI名称,但我想它不是CLI也不是Embed).

标签:php,apache,configuration

来源: https://codeday.me/bug/20190830/1771134.html

总结

以上是生活随笔为你收集整理的php enable all,php中的enable_dl配置如何有用?的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。