severndigital Posted January 21, 2009 Share Posted January 21, 2009 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 https://forums.phpfreaks.com/topic/141777-solved-exec-or-shell_exec-php-on-windows/ Share on other sites More sharing options...
severndigital Posted January 21, 2009 Author Share Posted January 21, 2009 i got it worked out. it seems i had to put the dir of the 7az.exe into the command to look like this c:\7za457\7za a -mx=9 c:\sandBox\178800.7z c:\ms6\178800 Link to comment https://forums.phpfreaks.com/topic/141777-solved-exec-or-shell_exec-php-on-windows/#findComment-742225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.