Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.3.11 |
Hello,
I'm using PHP 7.1 on IIS 7.5 and symfony/process always returns an empty output.
Here is a test case:
<?php
use Symfony\Component\Process\Process;
require_once __DIR__.'/vendor/autoload.php';
//This returns an output
var_dump(shell_exec('dir'));
$process = new Process('dir');
$process->mustRun();
//These return empty strings
var_dump(
$process->getOutput(),
$process->getErrorOutput()
);
What's strange is that it works when calling PHP (same binary) from the commandline.
And of course the same code works fine on my Linux/Apache server.
I tested various other commands (cd
, Python.exe
) and I always get the same empty result.
mustRun()
does throw an exception if the command does not exist:
PHP Fatal error: Uncaught Symfony\Component\Process\Exception\ProcessFailedException: The command "foobar" failed.
Exit Code: 1(General error)
Working directory: C:\inetpub\wwwroot
Output:
================
Error Output:
================
in C:\inetpub\wwwroot\vendor\symfony\process\Process.php:241
Stack trace:
#0 C:\inetpub\wwwroot\test.php(11): Symfony\Component\Process\Process->mustRun()
#1 {main}
thrown in C:\inetpub\wwwroot\vendor\symfony\process\Process.php on line 241
Edit: I also tried configuring IIS to use another PHP binary (installed with Chocolatey) and I get the same issue, so I guess it is linked to IIS itself.