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

 

 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.