Welcome to HostingForumz.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

PHP running external processes

 
   Web Hosting Problem Solving Community! (Home) -> IIS RSS
Related Topics:
Running External Processes in .NET with Win2K3/IIS 6 - I have an problem that I believe has to do with some IIS 6 settings that I am not aware of and I have just about exhausted searching google and this group. someone here can shed some light on the issue I am having. ..

Running an external application - I have an ISAPI DLL which I want to call and external from. If I call the from an excutable on the server it works as expected. The same code inside an ISAPI DLL does succeed but the external program is not running. I have full..

32 and 64 bit processes on 64bit 2003 R2 also running Exch.. - Hello, I have a rather annoying problem that I cant seem to work out properly. It appears the setup I am trying to build is a bit peculiar, although I dont think SO rare no one would know what to do. So here goes... I am running Win 2003 R2

SSL Processes on IIS 6 - Hoepfully someone here can help me with this. I have an IIS server with multiple IP Addresses assigned: every site gets its' own IP Address. I am also running Citrix Secure Gateway. It too is assigned a static IP Address and..

worker processes? - I'm using this 2003 Server to serve up about 30 static HTML sites and about 14 ASP sites. It's a 2-cpu box with 2 gig of RAM. I'm playing with pools. Out of the 14 ASP sites, I have 10 that are nearly
Author Message
troggy

External


Since: Jul 07, 2007
Posts: 2



(Msg. 1) Posted: Sat Jul 07, 2007 3:16 pm
Post subject: PHP running external processes
Archived from groups: microsoft>public>inetserver>iis (more info?)

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.

 >> Stay informed about: PHP running external processes 
Back to top
Login to vote
troggy

External


Since: Jul 07, 2007
Posts: 2



(Msg. 2) Posted: Sat Jul 07, 2007 4:00 pm
Post subject: Re: PHP running external processes [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 7, 11:41 pm, David Wang <w3.4... DeleteThis @gmail.com> wrote:
> On Jul 7, 3:16 pm, tro... DeleteThis @gmail.com wrote:
>
>
>
>
>
> > 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.
>
> It depends on the Win32 API that shell_exec() uses as well as the
> impersonated user identity used to execute the EXE.
>
> In general, launching EXE from IIS6 (and later) is not really going to
> work except under a few situations of elevated privileges. Mostly it
> is due to:
> 1. IIS6 no longer does interactive logon
> 2. ACLs on the System32 EXEs themselves
> 3. CMD.EXE has restrictions inside of it.
>
> Depending on shell_exec() implementation, you can try:
> 1. Running Application Pool with LocalSystem custom Identity
> 2. Authenticate as user in the Administrators group
>
> Personally, I do not launch REG.EXE to do this because one of the
> first things I shutdown is the RemoteRegistry service that this
> approach depends on. Also, you are assuming that the installed
> applications actually write an uninstall string. Unless I was stuck
> writing a limited batch-script to do this, I would use the MSI or WMI
> APIs to do this, without requiring elevation of privileges.
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> //- Hide quoted text -
>
> - Show quoted text -

Hi,

Thanks for the quick response. I agree, doing it through remote
registry isn't ideal. I would do it with WMI, but that doesn't store
information about non-MSI applications, does it? Unfortunately we
have a lot of non-MSI based applications that I need to find.

Thanks for the pointers anyway, I'll see if I can get it to work, or
maybe I'll have to come up with another way...

Neil.

 >> Stay informed about: PHP running external processes 
Back to top
Login to vote
David Wang

External


Since: Nov 04, 2007
Posts: 333



(Msg. 3) Posted: Sat Jul 07, 2007 10:41 pm
Post subject: Re: PHP running external processes [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jul 7, 3:16 pm, tro... RemoveThis @gmail.com wrote:
> 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.



It depends on the Win32 API that shell_exec() uses as well as the
impersonated user identity used to execute the EXE.

In general, launching EXE from IIS6 (and later) is not really going to
work except under a few situations of elevated privileges. Mostly it
is due to:
1. IIS6 no longer does interactive logon
2. ACLs on the System32 EXEs themselves
3. CMD.EXE has restrictions inside of it.

Depending on shell_exec() implementation, you can try:
1. Running Application Pool with LocalSystem custom Identity
2. Authenticate as user in the Administrators group

Personally, I do not launch REG.EXE to do this because one of the
first things I shutdown is the RemoteRegistry service that this
approach depends on. Also, you are assuming that the installed
applications actually write an uninstall string. Unless I was stuck
writing a limited batch-script to do this, I would use the MSI or WMI
APIs to do this, without requiring elevation of privileges.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
 >> Stay informed about: PHP running external processes 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting Problem Solving Community! (Home) -> IIS All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]