Jump to content

Moving files from one domain to another on the same server


flash gordon

Recommended Posts

Hello. First off, please forgive my ignorance with this subject matter. Server side and php is not my thing. Ok...end disclaimer.

 

Here is my situation. I have a dedicated server. The server has a user called "fudcake." Fudcake owns several other domains/users on the server such "foo", "bar", and "muckhead." I want fudcake to be able to copy or move files from it's domain of myserver.com/~fudcake to myserver.com/~foo. Now remember fudcake owns foo. Is this even possible? If so, what should be the server set up: suPHP, safe mode, chmods, etc?

 

Thanks for your time.

Cheers :)

Is it just a one time thing, or do you want it to continually keep the files between both domains the same?

 

If it's just once, do a cp -r of the directory that the first domain's files are in to the second's directory.

 

If you need it to continually keep the same content, don't waste space on your hard drive and just symlink the directories.

ln -s /path/to/dir1/ /path/to/dir2/

yea, I didn't think it would be a big thing either. However, I can't do it for the life of me. I'm trying to do it file_put_contents() but I get a permission denied error. I think the problem is php is running under the user "nobody" and "nobody" has no permission. That's just a guess. What else do you think is going on? Can i give you any error messages?

 

 

as for myserver.com/~fudcake and myserver.com/~foo this is the way the server represents accounts on the same machine. fudcake.com and foo.com is the same thing.

 

oh yea....i got a flash application that allows user uploads from the "main" folder of "fudcake". From there based upon the user's login id, I move the file with php to their own folder. So it's going to be a continuous process of moving files.

<?php
echo "Getting sound1.sql<pre>";
echo exec("whoami");
print_r(file_get_contents("/home/philkc34/public_html/config.xml"));
print_r(file_put_contents("/home/philkc34/public_html/stuff.txt","success"));
echo "</pre>";
?>

 

any ideas?

error message:

Getting sound1.sql

 

reseller

 

Warning:  file_get_contents(/home/philkc34/public_html/config.xml) [function.file-get-contents]: failed to open stream: Permission denied in /home/reseller/public_html/test.php on line 4

 

Warning:  file_put_contents(/home/philkc34/public_html/stuff.txt) [function.file-put-contents]: failed to open stream: Permission denied in /home/reseller/public_html/test.php on line 5

 

wow...that worked! I spent months and months on that. I owe you my first born. haha :)

 

Ok....I suppose the follow up question. cPanel is actually creating the folder. I don't want to have to manually configure the permissions all the time. So do you know how to set this up so that so that the user account is created with the correct permissions and "apache permissions"?

....actually 1 error still exist. I still don't have write access.....

Warning:  file_put_contents(/home/philkc34/public_html/stuff.txt) [function.file-put-contents]: failed to open stream: Permission denied in /home/reseller/public_html/test.php on line 5

Okay...well it looks like I got everything solved on that end. However, I have to do this process for every client domain on the server. Is there away to declare apache as part of the group/owner on a more global level?

 

Thanks again for all the help.

Is there away to declare apache as part of the group/owner on a more global level?

 

I think your asking how to change permissions on multiple directories at once? This really has nothing to do with php. Anyways, providing all these domains are within home setup just like your first example.

 

$ chmod o+wrx /home/*/public_html

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.