pls HELP: exec ('xcopy ...', $output) not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deiremus
Forum Newbie
Posts: 5
Joined: Sat Dec 12, 2009 4:46 am

pls HELP: exec ('xcopy ...', $output) not working

Post 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.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: pls HELP: exec ('xcopy ...', $output) not working

Post by josh »

define working & not working & post the command. what the ....? we cant read your mind.
deiremus
Forum Newbie
Posts: 5
Joined: Sat Dec 12, 2009 4:46 am

Re: pls HELP: exec ('xcopy ...', $output) not working

Post 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.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: pls HELP: exec ('xcopy ...', $output) not working

Post 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
deiremus
Forum Newbie
Posts: 5
Joined: Sat Dec 12, 2009 4:46 am

Re: pls HELP: exec ('xcopy ...', $output) not working

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: pls HELP: exec ('xcopy ...', $output) not working

Post by John Cartwright »

Moved to PHP-Code.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: pls HELP: exec ('xcopy ...', $output) not working

Post 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?
Post Reply