“出于安全原因已禁用exec()". & “未定义的变量" [英] "exec() has been disabled for security reasons" & "Undefined variable"

查看:94
本文介绍了“出于安全原因已禁用exec()". & “未定义的变量"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了一个很酷的MySQL备份脚本.在某些托管公司上运行良好. 现在,我正在运行PHP版本5.2.8的另一台主机上进行尝试.

I found a cool MySQL backup script. It's working fine on some hosting companies. Now I'm trying it on a different host running PHP Version 5.2.8.

我有一个包含此文件的php.ini文件(在根目录和当前目录中):

I have a php.ini file that contains this (in both root dir and current dir):

disable_functions =. 

我收到这些警告,似乎它们不仅仅是警告. 如果exec()没有运行,则不会备份数据库.

I'm getting these warnings, and it seems like they are more than warnings. If exec() doesn't run, the database is not backed-up.

未定义的变量:在 21
/home/nealsent/public_html/backups/backup_dbs.php 中输出 未定义的变量: 210
/home/nealsent/public_html/backups/backup_dbs.php 中的res 出于安全原因,在 210

Undefined variable: output in /home/nealsent/public_html/backups/backup_dbs.php on line 21
Undefined variable: res in /home/nealsent/public_html/backups/backup_dbs.php on line 210
exec() has been disabled for security reasons in /home/nealsent/public_html/backups/backup_dbs.php on line 210

代码如下.

// dump db
unset($output);

    // Line 210:
exec("$MYSQL_PATH/mysqldump $db_auth --opt $db 2>&1 >$BACKUP_TEMP/$db.sql", $output, $res);

推荐答案

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

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).

可能是主机根本不允许exec()期间.您对此无能为力.

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

这篇关于“出于安全原因已禁用exec()". & “未定义的变量"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆