LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-23-2009, 06:52 AM   #1
zawmn83
LQ Newbie
 
Registered: Aug 2008
Posts: 2

Rep: Reputation: 0
move_uploaded_file failed to open stream: Permission denied


Hi

I'm developing a website with PHP 5 and Apache.
There is a php page to upload files to webserver and some FTP users need to access to these uploaded files.
So I create a new group named G1 and add this group to both apache and FTP users.
Then set the permission of upload destination folder to 774, set owner to FTP user account and set group to G1.

When I try to upload file from php page, the following warning occur

Warning: move_uploaded_file(../papers/myfile.doc) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/httpd/vhosts/mydomain/httpdocs/mysite/upload-form.php on line 93

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpuXqVpb' to '../papers/myfile.doc' in /home/httpd/vhosts/mydomain/httpdocs/mysite/upload-form.php on line 93


When I click Refresh button on this warning page, the following message appear with Resend and Cancel button.
"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.".
I click Resend, the same warning page with different tmp file occur.

The strange thing is after I click Refresh button 4 or 5 time, the file is successfully uploaded and no warning appear.
Then I try again for another file, the same warning appear again. And I need to click Refresh 4 or 5 to upload success.

Please help me to find out what is the source of issue.

Thanks
 
Old 04-29-2009, 09:08 AM   #2
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Are you using SELinux on that system?

I'm asking, because that sounds like the typical type of illogical tomfoolery an enforcing SELinux installation can cause.

The first thing I always do is turn off SELinux on any new install I do... it causes unneccessary complexities and is IMO much too complicated for general use outside of the needs of the National Security Agency.

If you ARE using SELinux, try turning it off, and see if the problem persists.

Also:

Quote:
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpuXqVpb' to '../papers/myfile.doc' in /home/httpd/vhosts/mydomain/httpdocs/mysite/upload-form.php on line 93
musn't

Quote:
'../papers/myfile.doc' in
be

Quote:
/home/httpd/vhosts/mydomain/httpdocs/mysite/papers/myfile.doc
for it to work? I. e. your destination path is incorrectly specified in the call to move_uploaded_file?

Last edited by rylan76; 04-29-2009 at 09:16 AM.
 
Old 05-01-2009, 10:00 PM   #3
zawmn83
LQ Newbie
 
Registered: Aug 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for your reply.

I haven't no permission to turn off SELinux on server.
The destination path is correct. Because after I click Refresh button a few times, it is successfully uploaded to destination path.



Quote:
Originally Posted by rylan76 View Post
Are you using SELinux on that system?

I'm asking, because that sounds like the typical type of illogical tomfoolery an enforcing SELinux installation can cause.

The first thing I always do is turn off SELinux on any new install I do... it causes unneccessary complexities and is IMO much too complicated for general use outside of the needs of the National Security Agency.

If you ARE using SELinux, try turning it off, and see if the problem persists.

Also:



musn't



be



for it to work? I. e. your destination path is incorrectly specified in the call to move_uploaded_file?
 
Old 05-04-2009, 03:36 AM   #4
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by zawmn83 View Post
Thanks for your reply.

I haven't no permission to turn off SELinux on server.
The destination path is correct. Because after I click Refresh button a few times, it is successfully uploaded to destination path.
The strange thing here is the fact that you say "a few times" - i. e. it seems as if something has to "catch up" to your actions. This is why I suggested SELinux - i. e. maybe some dynamic permission allocation function / process has to complete before you can upload the file - the only thing I can think of that might do something like this is SELinux.

Have you checked whether you need to ALWAYS click the SAME number of times before it starts working, or is it always a variable number of seconds before it starts working??
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mount : ... failed, reason given by server: Permission denied knaries2000 Linux - Networking 4 06-25-2013 11:33 AM
udevd - rmdir(/dev/.udev/failed) failed: Permission denied pbhj Slackware 20 03-21-2008 10:46 AM
Failed to send mail : Write failed : Permission denied shawnbishop Linux - Software 1 03-27-2006 01:50 PM
php failed: Permission denied (13) in rino.caldelli Linux - Software 2 03-18-2006 11:25 AM
Wine Installation failed, permission denied enegron Linux - Newbie 4 10-15-2003 03:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration