Why does calling drush command by system()

2019-08-16 23:42发布

问题:

I have Drupal 7 site on IIS 7.5 server.

Inside IIS Services Manager I choose user with administrator rights in anonymous authentication settings.

I'm sure that drush command is in evn path. When I logged as this user (Win7) I can call this command everywhere.

However when I try to launch this command inside Drupal module:

  $output = array();
  $res = exec('drush --version', $output, $retval);

$retval is always 1 (error), $output and $res are empty.

Different command (sqlcmd) works ok. Both commands has identical rights (file system)

What I am doing wrong here?

Using absolute paths solves my issue, but only for paths without spaces.