|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-04-08 21:44 UTC] lagunaloire at argentina dot com
Description:
------------
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);
print_r($output);
Expected result:
----------------
Array
(
[0] => line1
[1] => line2
[2] => line3
)
Actual result:
--------------
Array () sometimes or nothing at all.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
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.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();Newly. To call exec from "some.php" you cannot do a require in this manner: chdir("somedir"); require("some.php"); You must do it in this manner: require("somedir/some.php"); And exec() will work in "some.php".