2013-05-06 80 views
1

我想在我的VPS上使用drupal维护任务。然而,我已经从我安装的firewall的自测结果的建议禁止exec()从PHP。 Drush显然想要这个特权,我见过三个选项来完成这项工作。我应该启用exec(),使用php安全模式还是更改php.ini?

  1. 使EXEC()
  2. 使用PHP安全模式
  3. 变化帐户的php.ini中 “disable_functions选项=系统,EXEC,了shell_exec,中继”

我的账号是唯一的管理员在Linux VPS上,我不打算改变这一点。我是VPS及其安全问题的新手。请告知哪个选项提供更安全的方法。

端子输出:

>exec() has been disabled for security reasons bootstrap.inc:639  [warning] 
The following restricted PHP modes have non-empty values:    [error] 
disable_functions and magic_quotes_gpc. This configuration is 
incompatible with drush. Please check your configuration settings in 
/usr/local/lib/php.ini or in your drush.ini file; see 
examples/example.drush.ini for details. 
exec() has been disabled for security reasons exec.inc:150    [warning] 
exec() has been disabled for security reasons exec.inc:150    [warning] 
exec() has been disabled for security reasons exec.inc:150    [warning] 
unlink(/home/site1/drush/lib/package.xml): No such file or   [warning] 
directory drush.inc:798 
The drush command 'status' could not be found. Run `drush    [error] 
cache-clear drush` to clear the commandfile cache if you have 
installed new extensions. 
Drush needs a copy of the PEAR Console_Table library in order to   [error] 
function, and the attempt to download this file automatically failed. 
To continue you will need to download the 1.1.3 package from 
http://pear.php.net/package/Console_Table, extract it into 
/home/site1/drush/lib directory, such that Table.php exists at 
/home/site1/drush/lib/Console_Table-1.1.3/Table.php. 
+0

你需要exec()来启动drush,或者需要exec()吗? – 2013-05-06 20:13:59

+0

看起来我需要它启动,我已经编辑了包括cli输出的问题。 – dimmech 2013-05-06 20:49:55

+0

如果您只需要启动drush,那么无论您是使用cron定期执行维护还是手动运行它,都可以使用不同的语言编写小脚本来启动应用程序,如Python或Java会没事的。 – 2013-05-07 10:42:30

回答

1

PHP有要么内置或可通过扩展许多功能。但是,有些情况下库或应用程序被设计为调用外部程序。如果没有exec,那么这些软件包根本无法工作,所以您可以选择允许使用exec还是不使用相关软件包。

忘记safe_mode:它已被弃用并将被完全删除。

exec自身的使用本质上不是不安全的 - 当程序没有正确地处理输入,或者代码被写入的方式允许人们以不符合预期的方式调用代码来调用exec时代表这个问题。由于Drush是一个管理工具,您已经期望这个只能由可信用户运行。我的意思是 - 它包括让你输入你想要的任何PHP代码,并evals()它!