LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 08: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, 11:25 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

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 11:37 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:30 PM
help in /var/www/html/!! chidomen Linux - Newbie 4 01-13-2005 12:02 PM
should var/www/html be accessible to root only? linuxfond Linux - Newbie 1 09-06-2003 03:00 PM
ownership of /var/www/html haobaba1 Linux - Security 1 08-04-2003 03:58 PM
chmod of /var/www/html alTereD Linux - Security 1 12-16-2002 03:43 PM


All times are GMT -5. The time now is 06:14 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration