|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49478 shell_exec does not work
Submitted: 2009-09-06 00:49 UTC Modified: 2009-09-22 20:57 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: elmue at gmx dot de Assigned: pajoye (profile)
Status: Closed Package: Program Execution
PHP Version: 6SVN-2009-09-06 (snap) 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: elmue at gmx dot de
New email:
PHP Version: OS:


 [2009-09-06 00:49 UTC] elmue at gmx dot de
On PHP 6 VC 6 from 3.sept.2009 the shell_exec command is broken.

Tested on Xampp on Windows XP with Apache 2.2.9.

Whatever you put into shell_exec e.g.
shell_exec("dir C:\\") 
produces a

Warning shell_exec() []: Unable to execute 'dir c:\'

The same script works fine on PHP 5


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-22 05:18 UTC] ian at iglou dot com
Also broken in PHP Version 5.2.10; safe mode off.

An earlier version (no record of which) did work when used thus to get a Windows dvd volume label:

if (preg_match('#Volume in drive [a-zA-Z]* is (.*)\n#i', shell_exec('dir '.$drive.':'), $m)) {
    $volname = ' ('.$m[1].')';
 [2009-09-22 08:41 UTC]
I can't reproduce it with php6 neither with 5.3 or 5.2 in CLI or FCGI.

Can you try it with CLI/CGI too please?
 [2009-09-22 13:46 UTC] elmue at gmx dot de

On which PHP6 version did you test it ?
Did you test on Windows ?

I used version build Sep 3 2009 21:23:55
 [2009-09-22 14:06 UTC]
Windows, today snaps.
 [2009-09-22 14:06 UTC]
Try with a recent snap please
 [2009-09-22 20:54 UTC] elmue at gmx dot de
Yes you are right.
In the build from 22.sep.2009 this bug is fixed.
 [2009-09-22 20:57 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Dec 10 01:01:27 2023 UTC