[2012年04月16日 05:55 UTC] pierre-eric dot mathez at ceff dot ch
Description:
------------
I've got a PHP script which execute a powershell script. I used PHP version 5.2.x and it is running on IIS 7, Windows server 2008R2. The php package is installed by the web platform installer.
Everything worked fine until I migrate my server to PHP 5.3.10. With this new version, the same command cause a powershell crash. Other person on a french forum has confirm my issue. I think it's a php bug because the operation run well on php 5.2 and not in 5.3.10.
The php script is quite simple, see test script
Test script:
---------------
$command = 'powershell -ExecutionPolicy Unrestricted -command "$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @(\'administrator\',(ConvertTo-SecureString -String \'MyPassword\' -AsPlainText -Force));Invoke-Command -credential $cred -computername 127.0.0.1 -scriptblock {& c:\temp\launch.ps1}" <NUL';
print($command);
print("<br/><hr><br/>");
exec($command, $out);
print_r($out);
Expected result:
----------------
the script execute successful (which is the case on php 5.2.17)
Actual result:
--------------
powershell return an error on Invoke-Command. I should clarify on thing: other scripts with other commands are running well, it's the invoke-command that is not possible to run with this version of php.