|
|
|
|
![]() ![]() |
Apr 10 2008, 04:53 PM
Post
#1
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 66 Joined: 2-April 08 From: Berkshire, England Member No.: 60,270 |
Okay, i've made a very, very simple PHP counter for my site, i've set up all the permissions and everything (triple checked permissions are right);
CODE <?php $hits = file_get_contents("/home/tracdoor/public_html/hitcounter.txt"); $hits = $hits + 1; $handle = fopen("hitcounter.txt", "w"); fwrite($handle, $hits); fclose($handle); print $hits; ?> Now that works fine on my homepage, or any page in the /public_html/ directory, but if i include that in one of my pages: CODE There have been <?php include ("/home/tracdoor/public_html/counter.php"); ?> hits. It says: QUOTE Warning: fopen(hitcounter.txt) [function.fopen]: failed to open stream: Permission denied in /home/tracdoor/public_html/counter.php on line 5 Can anyone find a way around this? or am i stuck? |
|
|
|
Apr 10 2008, 05:29 PM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,868 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
Exactly what permissions does the file have? 777?
And are all of the files contained in the public_html folder? |
|
|
|
Apr 10 2008, 08:39 PM
Post
#3
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 66 Joined: 2-April 08 From: Berkshire, England Member No.: 60,270 |
Yep, all the files are in public_html, and both the counter.php and hitcounter.txt are both 777, i'm just wondering whether there might be an fopen restriction, and with my limited knowledge of PHP, the only compromise i can see is adding both the files (counter.php and hitcounter.txt) into every directory, which i don't really want to do
|
|
|
|
Apr 11 2008, 03:16 AM
Post
#4
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,858 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
I think it may have to do with the fact that open_basedir is enabled in Trap17. I'm not entirely sure why this is happening to you, since fopen works for me, but try changing the file path from "hitcounter.txt" to "./hitcounter.txt".
|
|
|
|
Apr 11 2008, 10:15 AM
Post
#5
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 66 Joined: 2-April 08 From: Berkshire, England Member No.: 60,270 |
No, that didn't work, is there anyway around it? or am i just stuck?
|
|
|
|
Apr 12 2008, 01:13 PM
Post
#6
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,858 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
Try making a temporary empty folder in public_html, and copy "hitcounter.txt" and "counter.php" into that folder. Then modify "counter.php" located in that folder if need be, and run the file "counter.php" that's located in this newly created folder in your browser. Tell me if it still outputs that error.
|
|
|
|
May 26 2008, 02:38 PM
Post
#7
|
|
|
Newbie [Level 2] ![]() ![]() Group: [HOSTED] Posts: 39 Joined: 26-May 08 Member No.: 62,700 |
It looks like there're problems with fopen.
Try to call the support |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 20th July 2008 - 08:45 PM |