php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14701 Execute program
Submitted: 2001-12-26 12:47 UTC Modified: 2001-12-28 20:44 UTC
From: ngotau at hotmail dot com Assigned:
Status: Not a bug Package: Program Execution
PHP Version: 4.1.0 OS: Windows2000
Private report: No CVE-ID: None
 [2001-12-26 12:47 UTC] ngotau at hotmail dot com
I tried to exec simple program like as :
exec("dir C:",$results,$status)
but the $results return [Array] with out any string .
and $status return 0 .
How I can handle result ? 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-26 18:26 UTC] imajes@php.net
What you are describing is normal behaviour.

The way exec() works is that it executes the first argument, and then returns all the output to the second argument as an array. Finally, any status the command returns is sent to the third argument, if specified. 

You may find these pages informative:

http://www.php.net/manual/en/function.exec.php
http://www.php.net/manual/en/ref.array.php
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 08:01:23 2020 UTC