PHP running external processes

Giganews Newsgroups
Subject: PHP running external processes
Posted by:  trog…@gmail.com
Date: Sat, 07 Jul 2007

Hi,

I don't believe this is a PHP issue, so you may be able to ignore the
fact that I'm using it and see if this sounds like something more
generalised.

On a development machine I've been using (XP Pro, IIS 5.1, latest
version of PHP), I have a PHP script which uses the shell_exec command
to run c:\windows\system32\reg.exe to query a remote computer's
registry.  I'm developing a web based asset tracking and management
system, and I'm using this as a method to gain a list of software
installed on a remote computer.  It works excellently.  Here's the
command I'm using, if you're interested.

$o = shell_exec("c:/windows/system32/reg.exe QUERY \"\\\\{$hostname}\
\HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\" /s");

I then parse the returned data appropriately.  All well and good, and
it works brilliantly on the XP machine.

So, I move it to the production server (Windows Server 2003 with IIS6)
and it doesn't work.  There are no errors that I can find, I simply
don't get any data returned.  I've checked that reg.exe exists, and
uses the same syntax and everything.  I've checked privileges as well
as I know how.  The only thing I could think of was that I needed to
use IIS5 application isolation mode, so I tried that, and it still
didn't work.  So I'm a little stuck.

Any ideas what I can try to get this working?

Thanks in advance,
Neil.

Replies