“出于安全原因,exec() 已被禁用”

发布于 2024-08-13 17:20:48 字数 425 浏览 2 评论 0原文

我有一个命令在服务器上运行良好。现在我正在来自不同托管服务的服务器上尝试它。我有一个包含此内容的 php.ini 文件(在根目录和当前目录中):

disable_functions =. 

我收到此警告,并且 exec() 不运行。

由于安全原因,exec() 已在 210 行的 /home/nealsent/public_html/backups/backup_dbs.php 中禁用。

代码如下:

exec("mysqldump --opt db 2>&1 > db.sql", $output, $res);

I have a command working fine on a server. Now I'm trying it on a server from a different hosting service. I have a php.ini file that contains this (in both root dir and current dir):

disable_functions =. 

I'm getting this warning, and exec() doesn't run.

exec() has been disabled for security reasons in /home/nealsent/public_html/backups/backup_dbs.php on line 210

The code is the following:

exec("mysqldump --opt db 2>&1 > db.sql", $output, $res);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

┈┾☆殇 2024-08-20 17:20:48

许多主机禁用某些功能,并且不允许在自定义 php.ini 中覆盖它们(仅仅因为 PHP 提供了自定义 php.ini 的能力,并不意味着所有 PHP 设置都必须配置为允许您通过以下方式更改该选项这样的)。

主机可能根本不允许 exec() 期间。你对此无能为力。

Many hosts disable certain functions, and do not allow overriding them in custom php.ini's (just because PHP offers the ability to have a custom php.ini, does not mean that all PHP setups are necessarily configured to allow you to change that option via such).

Chances are that host simply doesn't allow exec() period. Not much you can really do about that.

你另情深 2024-08-20 17:20:48

Another possibility is that exec has been disable by PHP safe mode. From the referenced page, it looks like you could avoid this by putting the script you are exec-ing into the PHP "safe mode exec dir".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文