|
|
|
|
![]() ![]() |
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 Thanx |
|
|
|
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: [MODERATOR] Posts: 3,910 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
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? |
|
|
|
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 ***EDIT: I had to change the permissions for the individual files in question which i have now done and it now works perfectly. Thanx This post has been edited by shadowx: Apr 27 2006, 05:46 PM |
|
|
|
Apr 27 2006, 05:44 PM
Post
#4
|
|
|
apt-get moo ![]() Group: [MODERATOR] Posts: 2,061 Joined: 28-May 05 From: Hertfordshire, England Member No.: 7,593 ![]() |
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.
|
|
|
|
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: [MODERATOR] Posts: 3,910 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
here is more information on chmod, file and directory permissions, etc.: http://www.linuxpowered.com/html/editorials/file.html#sticky
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 8th August 2008 - 12:26 AM |