LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 02-21-2012, 12:41 AM   #1
buzzport
LQ Newbie
 
Registered: Feb 2012
Posts: 2

Rep: Reputation: Disabled
Angry php : fopen() with 'w' option


Hi,

I keep getting the "permission denied" error message. Can someone help me fix this problem I am having with my PHP script
( please see below )?



I have read a few forums, and tried the suggested fixes, but still can't get it to work.

Any suggestions?

operating system:
linux 16

Version of php:
5.3.10

line of code:
fp = fopen( "$DOCUMENT_ROOT/testfile/testfile.txt", "w" );

DOCUMENT_ROOT = /var/www/html

error message:
[Tue Feb 21 01:10:49 2012] [error] [client 127.0.0.1] PHP Warning: fopen(/var/www/html/testfile/testfile.txt): failed to open stream: Permission denied in /var/www/html/processorder.php on line 108, referer: http://localhost/orderform.html


file permission settings:
drwxr-xr-x. 21 root root 4096 Dec 15 10:14 var
drwxr-xr-x. 8 root root 4096 Dec 15 10:12 www
drwxr-xr-x. 3 root root 4096 Feb 21 01:09 html
drwxrwxrwx. 2 apache root 4096 Feb 21 01:08 testfile
-rwxrwxrwx. 1 apache root 0 Feb 20 07:59 testfile.txt
 
Old 02-21-2012, 12:47 AM   #2
buzzport
LQ Newbie
 
Registered: Feb 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Also, I tried chown root testfile etc.
but, received same error message:

rwxrwxrwx. 2 root root 4096 Feb 21 01:08 testfile
-rwxrwxrwx. 1 root root 0 Feb 20 07:59 testfile.txt
 
  


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
fopen() in PHP wh33t Programming 2 05-01-2011 09:48 AM
SELINUX and php fopen.. How to? latino Linux - Server 1 02-11-2008 09:37 PM
FC3, PHP 4.3.9, and fopen PERMISSION DENIED Cottsay Programming 4 06-25-2005 02:39 PM
Fopen has evaded me. (PHP Problem) dholingw Programming 3 03-04-2005 12:29 PM
PHP fopen question ? antony_csf Programming 2 02-15-2005 05:16 AM

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

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