|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67088 exec expect a carriage return
Submitted: 2014-04-16 17:23 UTC Modified: -
From: jakoch at web dot de Assigned:
Status: Open Package: Program Execution
PHP Version: 5.4.27 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jakoch at web dot de
New email:
PHP Version: OS:


 [2014-04-16 17:23 UTC] jakoch at web dot de
Calling "powershell" via "exec" hangs, when called in browser context.
The same call works on CLI.

Why is a prior echo'ing needed to get it working in the browser?

Issue solved with the workaround provided here:

Test script:
$output = array();
$return_code = 0;
// hangs in browser, but works on CLI
exec('powershell "New-Object -com WScript.Shell | Get-Member"', $output);
// works (in browser and on CLI)
//exec('echo . | powershell "New-Object -com WScript.Shell | Get-Member"', $output);

echo "<pre>";
foreach($output as $line) {
    echo $line . PHP_EOL;
echo "</pre>";


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jan 16 00:01:22 2021 UTC