duancashi1362 2013-05-06 20:08
浏览 132
已采纳

我应该启用exec(),使用PHP安全模式或更改php.ini?

I would like to use drush on my VPS for drupal maintenance tasks. However I've disallowed exec() from php at the suggestion of the self-test results from my installed firewall. Drush apparently wants this privilege and I've seen three options to make this work.

  1. enable exec()
  2. use php safe mode
  3. change the account's php.ini to "disable_functions = system, exec, shell_exec, passthru"

My account is the only admin on the Linux VPS and I don't plan to change that. I am new to VPS and its security concerns. Please advise on which option provides a more secure approach.

Terminal output:

>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.
  • 写回答

1条回答 默认 最新

  • dongqu9917 2013-05-06 20:59
    关注

    PHP has many functions that are either built in or available through extensions. However, there are some cases where libraries or applications were designed to call external programs. Without exec those packages simply aren't going to work, so you have your option of either allowing the use of exec or not using the package in question.

    Forget about safe_mode: it's deprecated and about to be removed entirely.

    The use of exec by itself is not inherently unsafe -- it's when programs don't properly sanitize input, or code has been written in a way that allows people to trick code into calling exec in a way it was not intended that represents the issue. As Drush is an administrative utility, you already have an expectation that this is something that will only be run by trusted users. I mean -- it includes letting you type in any php code you want and evals() it!!!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料