By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,310 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,310 IT Pros & Developers. It's quick & easy.

move_uploaded_file Permission denied

P: n/a
Hi

I am moving a site to a new server, I have been testing it
and one of the pages uses move_uploaded_file, but I
get a Permission denied.

The directory I am moving it to is chomd of 755, if I
change it to 777 it does upload but the owner is www-data,
but I then can't download it using a FTP client (which I have to do)
as it's the wrong owner, so I have to leave the chomd as 755, but
this point to being a server config problem, any ideas?

the errors I am getting is

Warning: move_uploaded_file(THE_PATH/1128467274.jpg): failed to open stream:
Permission denied in /var/www/vhosts/domain.com/httpdocs/login/library.php
on line 157

Warning: move_uploaded_file(): Unable to move '/tmp/phpptQSmo' to
'THE_PATH/1128467274.jpg' in
/var/www/vhosts/domain.com/httpdocs/login/library.php on line 157

Oct 5 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Brian wrote:
Hi

I am moving a site to a new server, I have been testing it
and one of the pages uses move_uploaded_file, but I
get a Permission denied.

The directory I am moving it to is chomd of 755, if I
change it to 777 it does upload but the owner is www-data,
but I then can't download it using a FTP client (which I have to do)
as it's the wrong owner, so I have to leave the chomd as 755, but
this point to being a server config problem, any ideas?

the errors I am getting is

Warning: move_uploaded_file(THE_PATH/1128467274.jpg): failed to open
stream: Permission denied in
/var/www/vhosts/domain.com/httpdocs/login/library.php on line 157

Warning: move_uploaded_file(): Unable to move '/tmp/phpptQSmo' to
'THE_PATH/1128467274.jpg' in
/var/www/vhosts/domain.com/httpdocs/login/library.php on line 157


Hi

SO targetdirectory has:
755
rwxr-xr-x
That says that ONLY the owner of the directory can write there.
You didn't give others (like www-data) to write in that directory.
You probably ment 766 or 764 or something depending on the fact if www-data
has a group you are in.

Solutions:
- change permissions to 766 or something
- Make www-data the owner of the folder where you are moving files to.

Regards,
Erwin Moller
Oct 5 '05 #2

P: n/a

"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:43***********************@news.xs4all.nl...
Brian wrote:
Hi

I am moving a site to a new server, I have been testing it
and one of the pages uses move_uploaded_file, but I
get a Permission denied.

The directory I am moving it to is chomd of 755, if I
change it to 777 it does upload but the owner is www-data,
but I then can't download it using a FTP client (which I have to do)
as it's the wrong owner, so I have to leave the chomd as 755, but
this point to being a server config problem, any ideas?

the errors I am getting is

Warning: move_uploaded_file(THE_PATH/1128467274.jpg): failed to open
stream: Permission denied in
/var/www/vhosts/domain.com/httpdocs/login/library.php on line 157

Warning: move_uploaded_file(): Unable to move '/tmp/phpptQSmo' to
'THE_PATH/1128467274.jpg' in
/var/www/vhosts/domain.com/httpdocs/login/library.php on line 157


Hi

SO targetdirectory has:
755
rwxr-xr-x
That says that ONLY the owner of the directory can write there.
You didn't give others (like www-data) to write in that directory.
You probably ment 766 or 764 or something depending on the fact if
www-data
has a group you are in.

Solutions:
- change permissions to 766 or something
- Make www-data the owner of the folder where you are moving files to.

Regards,
Erwin Moller


It turns out it was a little more than just basic permissions, it was to do
with
the nut and bolts of the server, think I have it sorted now, thanks for your
response

Brian
Oct 6 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.