php xcopy giving 0 files copied -
i trying xcopy in php, cant seem work, did try going down route of psexec copy command didn’t work either.
i have tried shell_exec,exec , passthru seem giving same error 0 files copied, yet if same command via command line files copy perfectly, cant permissions issue, must issue code, if can point out problem grateful
when execute via command line works:
c:\users\xante>xcopy c:\wamp\www\xcopy\copythis.bat \\testmachine\c$\xcopied c:\wamp\www\xcopy\copythis.bat 1 file(s) copied
when execute same command via php output:
array ( [0] => 0 file(s) copied) xcopy "c:\wamp\www\xcopy\copythis.bat" "\\testmachine\c$\xcopied\"
this php code:
$host="testmachine"; $execute = ('xcopy "c:\\wamp\www\xcopy\copythis.bat" "\\\"$host"\c$\xcopied\\"'); exec($execute,$output); print_r ($output)."<br />"; echo $execute;
turns out wamp bit awkward , issue wasn’t code related.
to fix issue have done following:
- ran services.msc
- looked wampapache,
- right clicked went properties,
- clicked on logon , ticked allow service interact desktop
- restarted wampapache , issue resolved
Comments
Post a Comment