Click to See Complete Forum and Search --> : Running windwos exec through PHP


michaelneo
02-18-2002, 04:42 PM
I tried running this code as a test and it did not work. Any ideas?

<?
exec("copy R:\Content\AD\GoldenPalace\wav\gpalace.wav R:\Content\AD\GoldenPalace\wav\rob.wav");
?>


I have the latest version of cgi PHP installed on IIS 2k and tested to make sure php is running properly. HELP!

-=Mike

Anon
02-18-2002, 11:09 PM
Why not use copy() ?

<?
copy("r:/gpalace.wav","r:/rob.wav");
?>

course you need to make sure PHP has permission to write to that dir was well but its alot easier then exitting to the shell

btw: the above works with IIS under XP

michaelneo
02-19-2002, 09:07 AM
Ok so that does work. Thanks. But I am trying to run an exec command and pass parameters into it. For example:

<?
exec("c:\encoder.bat -input ? -output ?")
?>

Any Ideas?

Anon
02-28-2002, 10:16 AM
Try this:

$command = "c:\encoder.bat ... ";

popen($command, 'w');

That works for me.

W(2k)AMP

dt9164
03-03-2002, 02:15 AM
I'm attempting the same thing sort of. I have a small program that outputs the currently playing song in winamp to a file. the program is song.exe. I have tried exec() system_exec() and the above mentioned popen(). None will cause the program to run. I'm not sure what i'm doing wrong, any help would be great. (php 4.1.1 Apache 2.0.32).