0

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.

apaderno
  • 28,547
  • 16
  • 75
  • 90
Codium
  • 3,200
  • 6
  • 34
  • 60
  • No idea about MS-Windows, but might this be a path problem? The http servers process looking for the executable in a different (smaller) set of paths than a normal user does? – arkascha May 18 '13 at 20:56
  • Also some commands refuse being used when not being called by an active tty. Always a bit of work to get around this... – arkascha May 18 '13 at 20:58
  • @arkascha for the comments, what is 'tty'? – Codium May 18 '13 at 21:00
  • A 'tty' is the controlling terminal. So something like the (virtual) controlling instance that calls some command. No oidea how that is called on MS-Windows. Typically it is interactively if it is a login shell a user created. A crontab entry on the other hand is not interactively. – arkascha May 18 '13 at 21:02
  • When I am calling this command inside teminal (command line) all works. But from PHP script, only sqlcmd works (return code is 0)... – Codium May 18 '13 at 21:08
  • 1
    Sure, I read that in your question. Command line is an interactive terminal (obviously), whilst with php it depends. If you use php on the command line it is interactively, if php is used by a crontab entry or an http server request then certainly that is not an interactive session. For example the openssh client behaves different in such situations. It really hard tries to prevent being used in non-interactive sessions, with good reasons (security). But as said: I have little knowledge of MS-Windows, can't even say if that system is evan able to distinguish between different types of ttys... – arkascha May 19 '13 at 05:58

0 Answers0