Re: [PHP] shell_exec, batch files, and IIS on Windows
The user that runs the php script under iis (IUSER_maschine name) should have permissions to execute the cmd.exe file, the .bat file and all the commands included in the .bat file. - Frank The manual entry for shell_exec has a comment that notes to execute .bat files with shell_exec, you need to pass the command through cmd.exe with the /c argument. I was wondering if anyone could share some insight on why that is. I've pretty much verified that this is the case. I can't execute .bat files at all from a Windows 2003 server running IIS. I can locally on my development workstation (XP running Apache). I've tried passing the command through cmd.exe on the server, but some of the commands in the .bat file does not run properly when going through cmd.exe. I suspect that IIS is a key culprit, but I have nothing concrete. I'd like to take a plausible theory to the IT guys before I request that they install Apache on that box. Thanks for any insight anyone might have. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] shell_exec, batch files, and IIS on Windows
hi, maybe you can try this: in the IIS properties, you can define the user running your IIS service. Ususally this is IUSR_xxx, but you can set a administrator user (see directory Security/ anonymous user) try to put your win login (prefixed with your domain\ and give your password. If you can execute your cmd and batch file, then you can be sure that the problem if an authorisation problem. Afterward, re-enter the IUSR_xx user as the anonymous user, because running as administrator is rather dangerous!! Also, try the 'Integrated windows Authentication', if this is checked, the anaonymous will NOY be used, but your own login will be used instead. As an example, if the Use integrated authentication is active, try a phpinfo() and you should find your own windows login as AUTH_USER (or others, don't remember). (if you have a login prompt, you can avoid it from the IE setting) Also, have a look at the event viewer and at the IIS log file. Maybe you will see the error reported by IIS... Vincent Dupont Principal Consultant OpenSource Competence Center Ausy Belgium http://www.ausy.be -Original Message- From: Frank M. Kromann [mailto:[EMAIL PROTECTED] Sent: Tue 2/27/2007 22:20 To: Shu Chow Cc: php-general@lists.php.net Subject: Re: [PHP] shell_exec, batch files, and IIS on Windows The user that runs the php script under iis (IUSER_maschine name) should have permissions to execute the cmd.exe file, the .bat file and all the commands included in the .bat file. - Frank The manual entry for shell_exec has a comment that notes to execute .bat files with shell_exec, you need to pass the command through cmd.exe with the /c argument. I was wondering if anyone could share some insight on why that is. I've pretty much verified that this is the case. I can't execute .bat files at all from a Windows 2003 server running IIS. I can locally on my development workstation (XP running Apache). I've tried passing the command through cmd.exe on the server, but some of the commands in the .bat file does not run properly when going through cmd.exe. I suspect that IIS is a key culprit, but I have nothing concrete. I'd like to take a plausible theory to the IT guys before I request that they install Apache on that box. Thanks for any insight anyone might have. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shell_exec, batch files, and IIS on Windows
On Tue, February 27, 2007 2:59 pm, Shu Chow wrote: The manual entry for shell_exec has a comment that notes to execute .bat files with shell_exec, you need to pass the command through cmd.exe with the /c argument. I was wondering if anyone could share some insight on why that is. I've pretty much verified that this is the case. I can't execute .bat files at all from a Windows 2003 server running IIS. I can locally on my development workstation (XP running Apache). I've tried passing the command through cmd.exe on the server, but some of the commands in the .bat file does not run properly when going through cmd.exe. I suspect that IIS is a key culprit, but I have nothing concrete. I'd like to take a plausible theory to the IT guys before I request that they install Apache on that box. Thanks for any insight anyone might have. No real insight, but a couple philosophical questions that may lead somebody who actually does Windows into something... When one runs a .bat file, isn't one already *IN* some kind of cmd.exe shell of some type to start with? OTOH, what is PHP doing with exec() on Windows if not firing up some kind of cmd.exe shell? You could run a test with Apache/Windows/exec fairly quickly on any box, without hitting the IT guys up with the request. Have proof in hand that IIS is culprit and Apache is saviour. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shell_exec, batch files, and IIS on Windows
Thanks, guys, for the responses. I'll check the events and IIS logs tomorrow. This afternoon, I put the IIS user into the Administrators group, but no luck - the same exact thing, or lack of thing, happened. I told this to the IT head and he agrees that it's probably not a permissions issue. After that he kind of warmed up to installing Apache on that box. They're absolutely not anti-Apache, just overworked and understaffed :/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php