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 :)

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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"?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.