Page 1 of 1
pls HELP: exec ('xcopy ...', $output) not working
Posted: Sat Dec 12, 2009 4:58 am
by deiremus
ive tried everything. it doesnt work. if anyone's asking if is there an issue with the escaping backslashes. i did escape them. and used the string command on the command line and its working properly.
Re: pls HELP: exec ('xcopy ...', $output) not working
Posted: Sat Dec 12, 2009 6:06 am
by josh
define working & not working & post the command. what the ....? we cant read your mind.
Re: pls HELP: exec ('xcopy ...', $output) not working
Posted: Sat Dec 12, 2009 7:43 am
by deiremus
sorry, all shell commands passed thru the exec function work. except for the xcopy
here's the a sample code i used:
exec ('xcopy c:\\source e:\\dest /E', $out);
i am trying to copy all the files and folders on the 'source' and copy it to 'dest' but nothing happened.
its not an issue of passing the wrong string to the command parameter of the exec function coz i directly used it on the command line and it worked just i wanted it to.
it doesnt even return a value for $out.
is there something wrong with my installation of the php program?
im using PHP 5 by the way. if it matters.
Re: pls HELP: exec ('xcopy ...', $output) not working
Posted: Sat Dec 12, 2009 3:54 pm
by josh
Did you try the command on the shell? It has to return an $out value, post it here. It may be null, it may be an empty string, but in programming everything has a "value" (even if that value represents that it does not have a value)
Also possibly the error message is being send to console or /dev/null, try redirecting all your outputs
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html
Re: pls HELP: exec ('xcopy ...', $output) not working
Posted: Sun Dec 13, 2009 2:30 am
by deiremus
Josh thanks for the reply!
$out should return an array containing elements who's values are line responses from the shell. but it only returns an empty array and nothing happens, no file transfered or folders copied on the destination.
Is it possible the had the wrong setup on my server which, make is restricts the xcopy command?
Re: pls HELP: exec ('xcopy ...', $output) not working
Posted: Sun Dec 13, 2009 2:35 am
by John Cartwright
Moved to PHP-Code.
Re: pls HELP: exec ('xcopy ...', $output) not working
Posted: Sun Dec 13, 2009 3:51 pm
by josh
Why don't you try my suggestion of redirecting the stderr output to a file or somewhere other then console. Not saying it's right but don't you think its kind of cheeky to ask for help and not try out any suggestions, yet continue asking unrelated questions?