Fedora Linux Support Community & Resources Center
  #1  
Old 10th February 2011, 12:18 AM
sepoto Offline
Registered User
 
Join Date: Dec 2010
Posts: 174
linuxfedorafirefox
I see no reason yet for this permission denied.

Wow! My file has full 777 access rights set. For some reason PHP is giving me a permission denied when I try to write to the file!

Code:
<?php
$yturl = $_POST['txtbx_youtube'];
$fp = fopen('urldata.dat', 'w');
fwrite($fp,$yturl);
fclose($fp);
?>
Code:
Warning: fopen(urldata.dat) [function.fopen]: failed to open stream: Permission denied in /var/www/html/writefile.php on line 3
Code:
[joecamel@localhost ~]$ cd /var/www/html/
[joecamel@localhost html]$ ls -la
total 652
drwxrwxrwx. 2 root root   4096 Feb  9 16:06 .
drwxrwxrwx. 6 root root   4096 Feb  8 10:33 ..
-rwxrwxrwx. 1 root root   2366 Feb  8 11:26 about.png
-rwxrwxrwx. 1 root root    560 Feb  9 16:03 adminpanel.php
-rwxrwxrwx. 1 root root   3045 Feb  8 11:14 archives.png
-rwxrwxrwx. 1 root root   9064 Feb  8 10:20 askthedatesaver.png
-rwxrwxrwx. 1 root root 234858 Feb  7 22:32 background.png
-rwxrwxrwx. 1 root root   3005 Feb  7 22:15 clickme.png
-rwxrwxrwx. 1 root root   3938 Feb  8 11:19 community.png
-rwxrwxrwx. 1 root root   2689 Feb  8 11:24 contests.png
-rwxrwxrwx. 1 root root  31123 Feb  7 19:17 cupidiscrazy.png
-rwxrwxrwx. 1 root root  41003 Feb  8 16:45 facebook.png
-rwxrwxrwx. 1 root root   2099 Feb  8 15:19 filletrec.png
-rwxrwxrwx. 1 root root   7491 Feb  9 15:00 index.php
-rwxrwxrwx. 1 root root  84362 Feb  9 11:41 jquery-1.5.min.js
-rwxrwxrwx. 1 root root  71682 Feb  8 18:44 manandwoman01.png
-rwxrwxrwx. 1 root root  34002 Feb  8 18:45 manandwoman02.png
-rwxrwxrwx. 1 root root   8394 Feb  8 18:47 manandwoman03.png
-rwxrwxrwx. 1 root root   6027 Feb  8 21:04 manandwoman04.png
-rwxrwxrwx. 1 root root   5134 Feb  7 19:22 manshead.gif
-rwxrwxrwx. 1 root root   2362 Feb  8 11:11 news.png
-rwxrwxrwx. 1 root root     52 Feb  9 14:50 phpdebug.php
-rwxrwxrwx. 1 root root     20 Feb  8 19:57 phpinfo.php
-rwxrwxrwx. 1 root root   2266 Feb  8 11:23 search.png
-rwxrwxrwx. 1 root root   5149 Feb  8 15:28 starempty.png
-rwxrwxrwx. 1 root root   3539 Feb  8 15:28 starwhole.png
-rwxrwxrwx. 1 root root  26897 Feb  8 16:46 twitterlogo.png
-rwxrwxrwx. 1 root root     41 Feb  9 14:55 urldata.dat
-rwxrwxrwx. 1 root root   3601 Feb  8 11:17 viewervids.png
-rwxrwxrwx. 1 root root    108 Feb  9 16:06 writefile.php
[joecamel@localhost html]$
Code:
[joecamel@localhost html]$ ls -lZ
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 about.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 adminpanel.php
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 archives.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 askthedatesaver.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 background.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 clickme.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 community.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 contests.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 cupidiscrazy.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 facebook.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 filletrec.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 index.php
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 jquery-1.5.min.js
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 manandwoman01.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 manandwoman02.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 manandwoman03.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 manandwoman04.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 manshead.gif
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 news.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 phpdebug.php
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 phpinfo.php
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 search.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 starempty.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 starwhole.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 twitterlogo.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 urldata.dat
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 viewervids.png
-rwxrwxrwx. root root unconfined_u:object_r:httpd_sys_content_t:s0 writefile.php
[joecamel@localhost html]$

Last edited by sepoto; 10th February 2011 at 12:20 AM.
Reply With Quote
  #2  
Old 10th February 2011, 01:18 AM
forkbomb's Avatar
forkbomb Offline
Registered User
 
Join Date: May 2007
Location: U.S.
Posts: 4,852
linuxfirefox
Re: I see no reason yet for this permission denied.

Check that PHP isn't in safe mode.

(As an aside, 777 is rarely an appropriate permissions set for anything.)
__________________
- Tom
"What is freedom? To have the will to be responsible for one's self." - Stirner
Reply With Quote
  #3  
Old 10th February 2011, 01:22 AM
sepoto Offline
Registered User
 
Join Date: Dec 2010
Posts: 174
linuxfedorafirefox
Re: I see no reason yet for this permission denied.

Here is a snapshot from my php.ini file. The only thing I have done to it since I installed is turn on display errors. It looks to me like safe mode is indeed off. Sorry about the 777 permissions but I am new to Linux and still learning every day how to work with it. Is there anything I can do to troubleshoot this problem? Is this a bug? Is there anything at all that can be done?

Code:
; Safe Mode
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode
safe_mode = Off

; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-gid
safe_mode_gid = Off

; When safe_mode is on, UID/GID checks are bypassed when
; including files from this directory and its subdirectories.
; (directory must also be in include_path or full path must
; be used when including)
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-include-dir
safe_mode_include_dir =

; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-exec-dir
safe_mode_exec_dir =
Reply With Quote
  #4  
Old 10th February 2011, 01:26 AM
jpollard Offline
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,105
linuxfedorafirefox
Re: I see no reason yet for this permission denied.

Your security label is blocking write.

httpd_sys_content_t is for read only data interpreted by apache.

If you want a directory/file to be writable then it must be labeled
httpd_sys_rw_content_t
Reply With Quote
  #5  
Old 10th February 2011, 01:29 AM
sepoto Offline
Registered User
 
Join Date: Dec 2010
Posts: 174
linuxfedorafirefox
Thumbs up Re: I see no reason yet for this permission denied.

Thank you kindly. I will update the necessary settings right away. Rack up more points for this forum which is always full of answers.
Reply With Quote
Reply

Tags
denied, permission, reason

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Permission Denied TheDukeofOgden Using Fedora 10 3rd September 2008 11:01 AM
problem with NFS (mount failed, reason given by server: Permission denied) betsubetsu Servers & Networking 2 21st June 2008 09:08 PM
Permission denied?? lch3920126 Using Fedora 2 18th November 2006 06:52 AM
Permission Denied Gettingthere Using Fedora 2 3rd June 2005 09:58 PM


Current GMT-time: 05:56 (Friday, 24-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat