move file from domain to subdomain

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
cnapsys
Forum Newbie
Posts: 15
Joined: Tue Nov 14, 2006 5:57 pm

move file from domain to subdomain

Post by cnapsys »

Hey all,
can anyone give me any pointers on how can I move a file from the main domain to a subdomain.

I've tried copy() and it didn't work.
I thought it was just a folder permission thing but after setting the destination folder to chmod 777 it still didnt work.
error reporting is turned off so I can't see exactly what the error message is.

box is rehl with plesk

php code

Code: Select all

$path1 = "/var/www/vhosts/domain.com/httpdocs/new/test/test.jpg";
$path2 = "/var/www/vhosts/domain.com/subdomains/img/httpdocs/test/test.jpg";
if (!copy($path1, $path2)) {
echo "failed to copy the file...";
}
Any help is greatly appreciated
greip
Forum Commoner
Posts: 39
Joined: Tue Aug 23, 2011 8:23 am
Location: Oslo, Norway

Re: move file from domain to subdomain

Post by greip »

Try enabling error reporting in your script to see what the problem is. See comments here: http://php.net/manual/en/function.error-reporting.php
cnapsys
Forum Newbie
Posts: 15
Joined: Tue Nov 14, 2006 5:57 pm

Re: move file from domain to subdomain

Post by cnapsys »

it returns a 2047... no clue what that is... any ideas?
cnapsys
Forum Newbie
Posts: 15
Joined: Tue Nov 14, 2006 5:57 pm

Re: move file from domain to subdomain

Post by cnapsys »

after further digging it seems to be an open_basedir restriction.
is there a way to get around this without having to disable open_basedir???
Post Reply