使用 dl() 从脚本加载 PHP 扩展
我打算购买一个(便宜的)托管空间,其中包含 apache/php 5/mysql。因为它很便宜,所以我无法直接控制 php.ini 和扩展加载。
我的问题是:我可以加载一个扩展程序,将 .dll
文件放入我的空间中,而不是使用 dl()
php 函数吗?主机可以禁用此功能从而避免以这种方式加载自定义扩展吗?
I'm going to buy a (cheap) hosting space with apache/php 5/mysql. Because it's cheap i have no direct control over php.ini
and extension loading.
My question is: can i load an extension putting the .dll
file into my space and than using dl()
php function? Can the host disable this feature thus avoid loading custom extension this way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,可以通过
enable_dl
禁用它safe_mode
php.ini 设置(几乎肯定是这种情况,否则您可以在 Web 服务器进程中加载您自己的代码)。这是对
disable_functions
设置的补充,该设置可以禁用任何东西。Yes, it can be disabled through the
enable_dl
andsafe_mode
php.ini settings (which would almost certainly be the case, as otherwise you could e.g. load your own code in the web server process).And that's in addition to the
disable_functions
setting, which can disable anything.主机可以从 php.ini 禁用 php 中的任何功能。事实上,如果主机保留此功能,我会感到惊讶。
the host can disable any function within php from the php.ini. in fact I would be surprised if the host left this feature on.
由于您谈论的是 .dll,因此您假设有一个运行 PHP 的 Windows 托管服务器,但是,最好咨询托管公司,因为 dl() 可能会被禁用。
较小的托管公司可以更愿意添加您可能需要的扩展。
Since you're talking about a .dll, you are assuming to get a Windows hosting server running PHP, however, is better that you check with the hosting company, because probably dl() will be disabled.
Smaller hosting companies can be more accommodating with adding extensions you may require.