Problem
I have a PHP script that uses shell_execpdf-to-text converter to run the converter. To simplify the task, I created a short script that uses shell_execto simply echo the output of the command dir.
<?php
$cmd = 'C:\\WINDOWS\\system32\\cmd.exe /c ';
echo shell_exec($cmd.' dir');
?>
When I run this on my Apache server, everything works as expected. When I switch to IIS, it seems to be completely overlooked: no errors, no output, no logs, nothing.
Unfortunately, I need to use IIS because I'm going to authenticate my users against the active directory.
Here is what I have tried so far:
- Run the command with
cmd.exe /c, rather than issue it directly - Grant
Read & Executepermission SERVICEto "C: \ WINDOWS \ system32 \ cmd.exe" - Grant
Read & Executepermission NETWORK SERVICEto "C: \ WINDOWS \ system32 \ cmd.exe" - Grant
Read & Executepermission IUSR_MACHINENAMEto "C: \ WINDOWS \ system32 \ cmd.exe" - Grant
Read & Executepermission Everyoneto "C: \ WINDOWS \ system32 \ cmd.exe" (don’t worry, it didn’t stay that long, haha) - Run PHP as an ASAPI Module
- This is my standard configuration.
- Run PHP as a CGI Extension
- This does not work, I get an error:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
- In IIS, set
Execute Permissionsto Scripts and Executableson its website - Added html markup function and other php functions for the script to find out if it is being processed; it does. It's like a bit is
shell_execjust skipped.
Thank you so much for looking at this question, now I am pulling my hair out with a problem
Cheers, Ian
Update 1
, , , Apache - ( shell_exec), apache script cURL. , :).
2
, IIS , , , , , , . ?