troubleshooting Question

php exec doesnt works on iis

Avatar of altariamx2003
altariamx2003Flag for Mexico asked on
Microsoft IIS Web Server
4 Comments1 Solution896 ViewsLast Modified:
I got a windows dedicated server with hostgator, there Im trying to add a exe script that receive some variables and after his process ends returns some result that the php page get and print, like this:
exec("files\\solver.exe 0 1 2 3 4 2>&1",$out,$exitcode);
echo "<br />EXEC: ( exitcode : $exitcode )";
echo "<hr /><pre>";
echo "</pre>";

$output = shell_exec("whoami");  
echo "<pre>$output</pre>";

But no matter what config i change I allways get the following error:
EXEC: ( exitcode : 1 )

    [0] => This program is blocked by group policy. For more information, contact your system administrator.

From the screens "iie-screen1.jpg" to "iie-screen5.jpg" its all changes that I do in IIS
And also this is my web.config file that im using on this site:
<?xml version="1.0" encoding="UTF-8"?>
                <rule name="rule seccion" stopProcessing="true">
	                <match url="^section/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//section/plantilla.php?rpl={R:1}" />
                <rule name="casos" stopProcessing="true">
	                <match url="^cases/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//cases/layout.php?rpl={R:1}" />
                <rule name="cursos" stopProcessing="true">
	                <match url="^trainning/courses/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//trainning/courses/plantilla.php?rpl={R:1}" />
                <rule name="otros" stopProcessing="true">
	                <match url="^trainning/others/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//trainning/others/plantilla.php?rpl={R:1}" />
                <rule name="talleres" stopProcessing="true">
	                <match url="^trainning/workshops/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//trainning/workshops/plantilla.php?rpl={R:1}" />
                <rule name="diplomados" stopProcessing="true">
	                <match url="^trainning/diploma/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//trainning/diploma/plantilla.php?rpl={R:1}" />
                <rule name="especialidades" stopProcessing="true">
	                <match url="^trainning/specific/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//trainning/specific/plantilla.php?rpl={R:1}" />
                <rule name="maestrias" stopProcessing="true">
	                <match url="^trainning/masters/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//trainning/masters/plantilla.php?rpl={R:1}" />
                <rule name="doctorados" stopProcessing="true">
	                <match url="^trainning/doctoral/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//trainning/doctoral/plantilla.php?rpl={R:1}" />
                <rule name="webinars" stopProcessing="true">
	                <match url="^trainning/webinars/([a-zA-Z0-9-]*)$" />
	                <action type="Rewrite" url="//trainning/webinars/plantilla.php?rpl={R:1}" />
            <remove name="prueba solver" />
            <add name="prueba solver" path="C:\inetpub\vhosts\\httpdocs\files\solver.exe" verb="*" modules="CgiModule" scriptProcessor="C:\inetpub\vhosts\\httpdocs\files\solver.exe" resourceType="File" requireAccess="Script" />

Thinking that maybe the problem was about the users and his permissions i add this two lines add the end of the test
$output = shell_exec("whoami");  
echo "<pre>$output</pre>";
to see who is the owner of the process, that result was "pvtc\iwpd_1(pvtadmin)", thats way I add him all permissions to the folder where i got the script(iie-screen6.jpg and iie-screen7.jpg).
Before to change the domain to the windows dedicated server with hostgator, I had my page pointed to another windows dedicated server where i has the page using xampp and all works without a problems
  $salida = array();
  exec("C:\\inetpub\\vhosts\\\\httpdocs\\solver.exe 0 1 2 3 4",$salida);
  echo $salida[0]; 

What im missing???

Wha im doing wrong???
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros