LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-01-2011, 08:34 AM   #1
emrkar
LQ Newbie
 
Registered: Mar 2004
Posts: 27

Rep: Reputation: 0
apache permission?.Cant write jpg file on my localhost :(


Hello everybody.

I am using ubuntu 9.10 and i installed apache php mysql.I cant acces my project and getting the error message 403 forbidden.

Anyway i used this command sudo chmod -R 755 /var/www and openned my page but my php script contains write images my drectory and getting this error
Warning: imagejpeg() [function.imagejpeg]: Unable to open './gallery/pm2_thumb.jpg' for writing: Permission denied in /var/www/gallery5/index.php on line 61

Note:
1.phpmyadmin and phpinfo() works.
2.Apache error logs:

[Fri Apr 01 12:24:49 2011] [notice] Apache/2.2.12 (Ubuntu) configured -- resuming normal operations
[Fri Apr 01 12:26:39 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 12:27:23 2011] [notice] Apache/2.2.12 (Ubuntu) configured -- resuming normal operations
[Fri Apr 01 12:28:31 2011] [error] [client ::1] File does not exist: /var/www/favicon.ico
[Fri Apr 01 12:28:34 2011] [error] [client ::1] File does not exist: /var/www/favicon.ico
[Fri Apr 01 12:29:21 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 12:29:27 2011] [notice] Apache/2.2.12 (Ubuntu) configured -- resuming normal operations
[Fri Apr 01 12:29:28 2011] [notice] Graceful restart requested, doing restart
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Fri Apr 01 12:29:28 2011] [notice] Apache/2.2.12 (Ubuntu) configured -- resuming normal operations
[Fri Apr 01 12:29:44 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 12:29:45 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 12:32:03 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 12:32:05 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 12:33:01 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 12:33:02 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 12:33:04 2011] [notice] Graceful restart requested, doing restart
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Fri Apr 01 12:33:05 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 12:34:07 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 12:34:07 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 12:34:07 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 12:34:07 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 12:34:07 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 12:34:07 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 12:34:50 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 14:29:08 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 14:29:35 2011] [error] [client ::1] File does not exist: /var/www/favicon.ico
[Fri Apr 01 14:29:35 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 14:29:35 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 14:29:35 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 14:29:35 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 14:29:35 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 14:29:35 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:17:26 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 15:19:03 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 15:22:39 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 15:22:40 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 15:22:57 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 15:22:57 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 15:22:57 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 15:22:57 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 15:22:57 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 15:22:57 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:23:12 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 15:23:13 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 15:33:38 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 15:33:39 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 15:33:43 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 15:33:43 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 15:33:43 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 15:33:43 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 15:33:43 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 15:33:43 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:33:44 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 15:33:44 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 15:33:44 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 15:33:44 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 15:33:44 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 15:33:44 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:33:47 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 15:33:47 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 15:33:47 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 15:33:47 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 15:33:47 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 15:33:47 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:33:48 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 15:33:48 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 15:33:48 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 15:33:48 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 15:33:48 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 15:33:48 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:35:09 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 15:35:10 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 15:35:13 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 15:35:13 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 15:35:13 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 15:35:13 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 15:35:13 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 15:35:13 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.html denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.cgi denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.pl denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.php denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.xhtml denied
[Fri Apr 01 15:35:14 2011] [error] [client ::1] (13)Permission denied: access to /gallery08Ben/index.htm denied
[Fri Apr 01 15:37:56 2011] [notice] caught SIGTERM, shutting down
[Fri Apr 01 15:37:57 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 15:38:01 2011] [crit] [client ::1] (13)Permission denied: /var/www/gallery08Ben/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Fri Apr 01 15:38:01 2011] [crit] [client ::1] (13)Permission denied: /var/www/gallery08Ben/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Fri Apr 01 15:38:15 2011] [notice] Graceful restart requested, doing restart
[Fri Apr 01 15:38:16 2011] [notice] Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.7 with Suhosin-Patch configured -- resuming normal operations
[Fri Apr 01 15:38:20 2011] [crit] [client ::1] (13)Permission denied: /var/www/gallery08Ben/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Fri Apr 01 15:40:26 2011] [crit] [client ::1] (13)Permission denied: /var/www/gallery08Ben/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Fri Apr 01 16:28:44 2011] [crit] [client ::1] (13)Permission denied: /var/www/gallery5/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Fri Apr 01 16:28:50 2011] [crit] [client ::1] (13)Permission denied: /var/www/gallery5/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Fri Apr 01 16:30:16 2011] [error] [client ::1] File does not exist: /var/www/gallery5/gallery/pm2_thumb.jpg, referer: http://localhost/gallery5/





Then i used this command again sudo chmod -R 755 /var/www and nothing changed. Please help
 
Old 04-01-2011, 08:50 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

The directory /var/www/gallery must be writable by the apache user. If I'm not wrong in ubuntu it's www-data, so you have to run:
Code:
chown -R www-data:www-data /var/www/gallery
Regards
 
Old 04-01-2011, 09:09 AM   #3
emrkar
LQ Newbie
 
Registered: Mar 2004
Posts: 27

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Hi,

The directory /var/www/gallery must be writable by the apache user. If I'm not wrong in ubuntu it's www-data, so you have to run:
Code:
chown -R www-data:www-data /var/www/gallery
Regards
Thank you very much bathory, now my code is work.

but i don't understand www-data:www-data.What is the mainilng?

Last edited by emrkar; 04-01-2011 at 09:20 AM.
 
Old 04-01-2011, 10:30 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Glad to see it worked.

Apache runs as a not privileged user for security reasons. In ubuntu this user is www-data and belongs to group www-data. So if you want a script that is going to be run through apache to write in a directory, then the apache user must have write permissions in that directory. That's what the chown command does.
Since your question is answered, you can mark this thread "Solved" from "Thread tools" on top of the page.

Regards
 
Old 04-01-2011, 10:34 AM   #5
emrkar
LQ Newbie
 
Registered: Mar 2004
Posts: 27

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Glad to see it worked.

Apache runs as a not privileged user for security reasons. In ubuntu this user is www-data and belongs to group www-data. So if you want a script that is going to be run through apache to write in a directory, then the apache user must have write permissions in that directory. That's what the chown command does.
Since your question is answered, you can mark this thread "Solved" from "Thread tools" on top of the page.

Regards
Thank you bathory.
 
  


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
recursive write permission on cifs mounted file system mamunbabu2001 Linux - Newbie 2 05-18-2010 08:23 AM
apache : localhost/ works localhost/index.html does not PhilA Linux - Server 4 05-27-2007 07:32 PM
Regarding default uploaded file permission in apache chandramani Linux - General 0 03-23-2006 09:11 AM
Apache File Permission Strange Problem hcubed Linux - Networking 1 05-15-2004 01:09 AM
smb.conf file write permission jbraum Mandriva 3 01-09-2004 05:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:19 AM.

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