I posted this in the general forum before I realized there is a PHP forum.
I am trying to get Wscript.shell to run on IIS 7.5/PHP 5.5.4 (Windows 7 development machine). It works perfectly on IIS Express (VS Express for Web). PHP code is shown below. User enters data on web form and clicks button. Javascript sends AJAX request to server with info on which document to create. PHP creates a job file with instructions and executes Word with addin that reads job file. Word with addin (VBA) runs on server and creates docx/pdf files. PHP sends back JSON object with details on files. Javascript updates links to files. This process works great on IIS Express. When I run it on IIS it hangs. IIS and IIS Express are using the same PHP install so .net is enabled and working. So I am thinking that IIS either does not have some feature enabled or does not have permissions to something. I added IIS_IUSRS to the Word exe and made sure IIS_IUSRS has execute permissions to the PHP code. All other PHP scripts work perfectly. I don't get any error message from IIS log files.
Any ideas are appreciated.
$t = time(); $job = 'C:\temp\Job' . $t . ".txt"; $fp = fopen($job, 'w'); fwrite($fp, $cmd); fclose($fp); $job2 = 'C:\temp\Job' . $t . "a.txt"; // copy gets around some strange problem with Word opening file. copy($job, $job2) or die("Unable to copy $old to $new."); $runWord = '"C:\Program Files\Microsoft Office\Office14\Winword.exe" "' . $job2 . '" "C:\userdata\tripq\trip-web\trip-web.dotm"'; //echo $runWord; $WshShell1 = new COM("WScript.Shell"); $oExec1 = $WshShell1->Run($runWord, 7, true);