php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13512 The backtick operator only returns stdout, not stderr
Submitted: 2001-10-02 10:27 UTC Modified: 2007-07-24 15:40 UTC
From: strecket at hotmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.0.5 OS: FreeBSD
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: strecket at hotmail dot com
New email:
PHP Version: OS:

 

 [2001-10-02 10:27 UTC] strecket at hotmail dot com
If I use the backtick operator, like:

 $output = `command goes here`;

and if the program 'command' returns its output to stderr and not stdout, then it's not easy to get the output.

Right now, it can be solved by adding:

 2> /tmp/file/here

and then reading the file in the script, but that's not a good solution.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-05 03:20 UTC] edink@php.net
What you want can be probably be achieved with:

$output = `command 2>&1`;

 [2001-10-05 05:02 UTC] strecket at hotmail dot com
RE: edink@php.net

Yes, but that's platform specific solution, so I think it would be better to make PHP return the output to stderr too.

For example, that doesn't work on Win9x.
 [2007-07-24 15:40 UTC] jani@php.net
It works fine in the windows versions I've tried it on. And current PHP versions don't work with Win9x anyway -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 14:01:33 2024 UTC