Can somebody explain why the following works...

<?php
system("ls /home/hans/");
?>

and this not.....

<?php
system("cp /home/hans/data.txt /home/hans/data.tx2");
?>

For the life of me, I can't figure it out. I simply want to copy a file, so why won't php let me do this? Please help, because I'm getting a little frustrated. --Hans

Recommended Answers

All 2 Replies

hmm..

Maybe check the file permission of the folder,maybe the permission is limited.try to change it to 777.

do you run this script as owner of this home directory? or you can try chmod 777

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.