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 08-09-2003, 10:08 PM   #1
tuka
Member
 
Registered: Jul 2003
Location: Lisbon, Portugal
Distribution: Red Hat 9.0
Posts: 30

Rep: Reputation: 15
File Permission Error in PHP fopen() function


My Question has to do with the following error given by the following line in my PHP code. Also included is the details of the files and foolder. In this case the file I want is in the Chapter02 folder and is also owned by root.

Errors returned from PHP (browser):

Warning: fopen("/var/www/html/chapter02/orders.txt", "a") - Permission denied in /var/www/html/chapter02/processorder.php on line 55


Line in Source:
$fp = fopen ("$DOCUMENT_ROOT/chapter02/orders.txt", "a");


A brief listing of my root:
dr-xr-xr-x 2 root root 4096 Aug 10 01:59 chapter01
dr-xr-xr-x 2 root root 4096 Aug 10 02:20 chapter02
dr-xr-xr-x 2 root root 4096 Feb 22 2001 chapter03



It seems to me that this may be a permissions issue according to the which user is the owner of a file create in my PHP app - it seems to me that httpd should be the owner and group but I am not sure...

Greatly appreciate your help and clarification to this problem.

Tuka
 
Old 08-10-2003, 06:35 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
i'd assume that "a" is for Append.. so you need write acess as the apache user... which is probably httpd or apache... or maybe web, www etc... if you don't know, run somethign like "ps aux" and see who owns the apache processes
 
Old 08-12-2003, 09:16 PM   #3
tuka
Member
 
Registered: Jul 2003
Location: Lisbon, Portugal
Distribution: Red Hat 9.0
Posts: 30

Original Poster
Rep: Reputation: 15
Yes that did it !!! thanks for your help... Tuka
 
  


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
FC3, PHP 4.3.9, and fopen PERMISSION DENIED Cottsay Programming 4 06-25-2005 03:39 PM
PHP fopen question ? antony_csf Programming 2 02-15-2005 06:16 AM
Passing one php function result as a parameter to another php function davee Programming 13 09-12-2004 01:08 PM
PHP Function to return the most recent error. id10t Programming 5 05-30-2004 07:24 PM
Can I run localhost/file.php with CRON function kondor5 Linux - General 1 03-28-2004 07:44 AM

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

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