LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-07-2006, 07:51 AM   #1
jon23d
Member
 
Registered: May 2006
Location: Kennewick, WA - USA
Distribution: Ubuntu
Posts: 129

Rep: Reputation: 15
php move_uploaded_file() not working in /var/www/html


I have some php code that takes an uploaded file (on my local system) and is supposed to move it to another directory. The default temp directory that files are uploaded to (which is fine by me) is /tmp.

I have changed the webroot (/var/www) to be owned by the group 'webmasters'. I'm wondering if this is why PHP cannot move temp files from /tmp to /var/www/html/images...

When I use move_uploaded_file to just rename it and move the image to /tmp (under another name) then everything is fine. This is why I wonder if it is a user-level issue. I'm rather new to linux and cannot find under which user php is running. Do I need to add this user to the webmasters group? When I try to get an error a null string is returned....

Thanks!
 
Old 06-07-2006, 10:25 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Apache runs as user nobody who is member of group nobody. Apache needs to be able to traverse all directories, so every directory needs execute permissions for 'others'.
In the final directory, it needs write permissions as well.

My document root is /server/www/htdocs/btd/web. The following shows the permissions as I've set them up.
Code:
drwxr-xr-x   4 root root          72 2006-04-19 15:58 server/
drwxr-xr-x   5 root root         120 2001-02-26 03:59 www/
drwxrwxrwx   4 root root        1424 2006-05-22 07:42 htdocs/
drwxr-xr-x   4 wim  develop       96 2006-03-09 04:18 btd/
drwxr-xr-x   3 wim  develop      192 2006-05-23 16:14 web/
drwxr-xr-x   3 wim  develop      760 2006-05-22 09:38 btd_docs/
drwxrwxr--   3 librarian nobody  152 2006-05-15 13:07 documents/
There are two 'sub-sites' under it, one being btd_docs. This one contains a directory documents where apache places uploaded files.

Last edited by Wim Sturkenboom; 06-07-2006 at 10:37 AM.
 
  


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
index.html is not noticed in /var/www/html xviddivxoggmp3 Red Hat 1 04-23-2006 06:30 PM
help in /var/www/html/!! chidomen Linux - Newbie 4 01-13-2005 11:02 AM
should var/www/html be accessible to root only? linuxfond Linux - Newbie 1 09-06-2003 02:00 PM
ownership of /var/www/html haobaba1 Linux - Security 1 08-04-2003 02:58 PM
chmod of /var/www/html alTereD Linux - Security 1 12-16-2002 02:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:23 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