Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Problem With Opening And Reading Files In Php, access denied error using fopen etc...
shadowx
post Apr 27 2006, 05:05 PM
Post #1


A clever man learns from his own mistakes, a WISE man learns from those of OTHERS
*********

Group: [HOSTED]
Posts: 884
Joined: 12-April 06
From: Essex, UK
Member No.: 21,719



Hi all

I'm having a problem when using php to read from a text file the error is this:
CODE
failed to open stream: Permission denied in /home/shadyx/public_html/index.php


And this obviously stops fread and fwrite from working. the code i used for this is...
CODE

$handle = fopen("ipstuffs/iplog.htm", "a");
fwrite($handle, "date: $date <BR> $ip <BR>Referrer: $refer_url<BR><HR><BR>");
fclose($handle);


It runs nicely on my xampp IDE so i dont think its the code, possibly a setting in the ini file but i do not know how to edit that ( if its even possible ) online. Can anyone shed light on this problem? in the file manager in the cpanel i have set permissions for user and group to all as i thought this could be the problem but it had no effect.

Please help sad.gif

Thanx
Go to the top of the page
 
+Quote Post
jlhaslip
post Apr 27 2006, 05:13 PM
Post #2


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,910
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



have you set user, group, world permissions to a full "777"?

and why print the html br tags and the hr tags to the file? maybe try comma seperated format?

Go to the top of the page
 
+Quote Post
shadowx
post Apr 27 2006, 05:35 PM
Post #3


A clever man learns from his own mistakes, a WISE man learns from those of OTHERS
*********

Group: [HOSTED]
Posts: 884
Joined: 12-April 06
From: Essex, UK
Member No.: 21,719



i have just set the directory public_html to 777 and the same error still. its odd as it is able to read from another file yet when writing to that file it gives the same error that access is denied. So it must be something with the write permissions but i cant think why.

And i add the BR and HR tags because its a plain text file printed into the html content so is parsed as normal html and this way i can stop people posting things like html tags and js scritps etc... im just not advanced enough yet to use commas and such laugh.gif


***EDIT: I had to change the permissions for the individual files in question which i have now done and it now works perfectly. smile.gif thanks for the help. Hope other people learn from my mistake because that was annoying!

Thanx

This post has been edited by shadowx: Apr 27 2006, 05:46 PM
Go to the top of the page
 
+Quote Post
rvalkass
post Apr 27 2006, 05:44 PM
Post #4


apt-get moo
Group Icon

Group: [MODERATOR]
Posts: 2,061
Joined: 28-May 05
From: Hertfordshire, England
Member No.: 7,593
Spam Patrol



Just setting the public_html directory to 777 does not necessarily work. Different FTP programs work in different ways for CHMOD, some apply the settings just to the folder, some to everything within it and some ask. Make sure you specifically set that file to permissions of 777.
Go to the top of the page
 
+Quote Post
jlhaslip
post Apr 27 2006, 06:01 PM
Post #5


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,910
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



here is more information on chmod, file and directory permissions, etc.: http://www.linuxpowered.com/html/editorials/file.html#sticky
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. 403 Forbidden Error When Accessing My Site(11)
  2. Is It Possible To Access The Mysql Remotely?(10)
  3. Error Code In Subscriptions Page(5)
  4. I Cannot Access My Site. [resolved](13)
  5. Problems With Ftp Access(1)
  6. Unable To Access Cpanel(6)
  7. Has Anyone Ever Seen This Before?(7)
  8. Cannot Access Cpanel...(3)
  9. Mysqli Error - Phpbb3(3)
  10. Sub Domain Problem : Urgent(10)
  11. Server Issues? Web Site Down? Cpanel Access?(48)
  12. Phpmyadmin Error(4)
  13. Phpmyadmin Error [resolved](7)
  14. Anonymous Ftp Access?(2)
  15. Remote Access Mysql(8)
  1. I Cant Access The Server!(1)
  2. Official: Can't Access My Cpanel - Supports From Admins(69)
  3. Coppermine Gallery Error(2)
  4. Page Load Error When Accessing Cpanel(0)
  5. How Do I Find My Mysql Password? [resolved](5)
  6. Almost There, However.... [resolved](7)
  7. Can't Access My Site....weird Issue(5)
  8. Can't Access My Site An Cpanel(4)
  9. No Site Access(4)
  10. Error 28 (on Phpmyadmin)(7)
  11. Phpbb3 - Error 28(5)
  12. Wordpress Error - Bytes Exausted [resolved](7)
  13. Hosting Problem [resolved](19)


 



- Lo-Fi Version Time is now: 8th August 2008 - 12:26 AM