|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44675 no output from exec()
Submitted: 2008-04-08 21:44 UTC Modified: 2008-04-08 22:15 UTC
From: lagunaloire at argentina dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.2.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: lagunaloire at argentina dot com
New email:
PHP Version: OS:


 [2008-04-08 21:44 UTC] lagunaloire at argentina dot com
The exec() function does not fill the &$output array!
I don't get the output from any program what I try to execute in Safe mode or not.

Reproduce code:
exec("program", $output);

Expected result:
  [0] => line1
  [1] => line2
  [2] => line3

Actual result:
Array () sometimes or nothing at all.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-08 22:01 UTC] lagunaloire at argentina dot com
A compilation problem. First I was compiled apache newly and forget to recompile PHP. I recompiled PHP and it is working now.
 [2008-04-08 22:06 UTC] lagunaloire at argentina dot com
Not not! I mistake! I just put something in the array like this:
$output=array("nothing here", "nothing there");
And I see that but that does not mean what I'm seing that from the program what I executed! Just I was seing it from the self php script.
Sorry!! =S It is not working still! I don't get filled the array with the output for the external program.
 [2008-04-08 22:11 UTC] lagunaloire at argentina dot com
I found the problem. The problem is YOU CANNOT CALL exec() FROM A REQUIRED PHP. That mean if you require("somepage.php"); in somepage.php you cannot call exec();
 [2008-04-08 22:15 UTC] lagunaloire at argentina dot com
Newly. To call exec from "some.php" you cannot do a require in this manner:

You must do it in this manner:

And exec() will work in "some.php".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 14:01:32 2024 UTC