Jump to content

[SOLVED] exec or shell_exec PHP on windows


severndigital

Recommended Posts

I am using wamp on a windows XP machine and I am having trouble running command lines from with in PHP.

 

the following example works.

 

$output = shell_exec('dir /B /A:D c:\\ms6');
echo var_export($output,TRUE);

 

it works and returns the desired results. however this one does not.

 

$output = shell_exec('7za a -mx=9 c:\\sandBox/cmdCompTest.7z c:\\ms6');
echo var_export($output,true);

 

When i run the shell command from the command prompt it works just fine and creates the cmdCompTest.7z file just fine. But when I run the command from within PHP i do not get anything.

 

I have tried both the exec() and shell_exec() command with no success.

 

I have implemented similar things in PHP on linux machines, but this is my first attempt at the shell_exec or exec commands on windows box. Any help would be great.

 

Thanks,

-C

 

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.