如何在 Debian 上关闭 php 中的 safe_mode?
我知道,这可能听起来很荒谬,但我无法关闭安全模式。我正在使用 wkhtmltopdf (这是我用过的最好的 html->pdf 转换器,是的,我尝试过 html2ps、fpdf 和许多其他转换器)。并且需要用exec()函数来执行。我已经
- 找到/ | grep php.ini,
找到所有 php.ini 并将 safe_mode 更改为 Off。然后将
- php_flag safe_mode Off
添加到.htaccess,并将
- php_admin_flag safe_mode Off添加
到httpd.conf。我仍然收到以下错误:
- 警告(2):shell_exec() [function.shell-exec]:无法执行 在安全模式下使用反引号 [APP/vendors/wkhtml/wkpdf.php,行 79]
更新: 好的,我找到了答案。由于我有虚拟主机,每个虚拟主机在其自己的目录中都有自己的 httpd.conf,并且其中有“safe_mode off”。
I know, it may sound ridiculous, but I can't turn off safe_mode. I'm using wkhtmltopdf (which is best html->pdf converter I've used, and yes, I tried html2ps, fpdf and lots of others). And it needs to be executed with exec() function. I've done
- find / | grep php.ini,
found all of php.ini's and changed safe_mode to Off. Then added
- php_flag safe_mode Off
to .htaccess and
- php_admin_flag safe_mode Off
to httpd.conf. And still I'm getting the following errors:
Warning (2): shell_exec()
[function.shell-exec]: Cannot execute
using backquotes in Safe Mode
[APP/vendors/wkhtml/wkpdf.php, line
79]
Update:
Ok, I've found an answer. Since I had virtualhosts, each virtualhost had it's own httpd.conf inside of it's own directory, and it had "safe_mode off" inside of it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好的,我找到了答案。由于我有虚拟主机,每个虚拟主机在其自己的目录中都有自己的 httpd.conf,并且其中有“safe_mode off”。
抱歉打扰了。
Ok, I've found an answer. Since I had virtualhosts, each virtualhost had it's own httpd.conf inside of it's own directory, and it had "safe_mode off" inside of it.
Sorry for disturbance.
您可能忘记重新启动 httpd。
另外,这个问题属于ServerFault。
You have probably forgot to restart your httpd.
Also, this question belongs on ServerFault.
也许在 shell_exec() 之前使用 ini_set() 禁用安全模式?但可能 ini_set 在安全模式下也被禁用......
maybe use ini_set() to disable safemode right before shell_exec() ? but propably ini_set is disabled in safemode as well...