tracdoor
Apr 10 2008, 04:53 PM
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?
Reply
jlhaslip
Apr 10 2008, 05:29 PM
Exactly what permissions does the file have? 777? And are all of the files contained in the public_html folder?
Reply
tracdoor
Apr 10 2008, 08:39 PM
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
Reply
truefusion
Apr 11 2008, 03:16 AM
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".
Reply
tracdoor
Apr 11 2008, 10:15 AM
No, that didn't work, is there anyway around it? or am i just stuck?
Reply
truefusion
Apr 12 2008, 01:13 PM
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.
Reply
Recent Queries:--
fopen into a directory - 334.00 hr back.
-
fopen http setcookie - 341.23 hr back.
-
fopen restriction - 401.31 hr back.
-
fopen 0x00000000 "w" - 668.94 hr back.
Similar Topics
Keywords : fopen, errors, grrr, im, angry,
- New Found Php Coding Errors
I always thought these worked, but suddenly they no longer do?! (5)
Header Redirect Errors
(5) Hi, I am using the header function to redirect after the processing of the form. I have to specify
a internal link using '#link'. This works in Firefox and opera. But in Internet Explorer
internal linking when done from a redirect is not working for somewhat reasons. e.g.
header("Location: http://www.example.com/index.php#link"); this works in Firefox and Opera but
not in Internet Explorer . IE just accepts 'http://www.example.com/index.php' instead of
http://www.example.com/index.php#link Please help me if you know anything about this. Well ther....
Script Not Working :s
mysql errors (5) process_login.php: Process the login. $host = "localhost";// the host that u are connecting
$username = "root";// user name $password = ""; // passworld $basedatos =
"forum"; //Dont change this1. $db = mysql_connect($host, $username, $password);
mysql_select_db($basedatos, $db); $user= $_REQUEST ; $pass=
md5($_REQUEST ); $query1= "SELECT * FROM smf_members WHERE
memberName='$user'"; $mkquery= mysql_query($query1,$db); $row1=
mysql_fetch_assoc($mkqu....
Help With Fopen Script
(4) this is what i have so far, i was just wondering if anyone could help me with a problem im having...
i really dont know how to say if a variable doesnt exist, because i want it to either a) choose a
random quote or /cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" />
choose quote X where X is $get_ could anyone help me please? this is what i have so far :S
CODE <?php $num = $GET_['n']; if ($num == NULL) {
$num = rand(1,400); $open = fopen("http://stirk.simple....
Getting Errors On A Script
need to know what im doing wrong (3) ok please help me!! im trying to get this tournamt/leage ladder script working, its with php
but i think i put all the files in the right palces but i keep getting this error .... CODE
Warning: main(modules/NukeLadder/admin/index.php): failed to open stream: No
such file or directory in /home/berkolli/public_html/DjLuki/admin/case/case.php on line 77
Warning: main(modules/NukeLadder/admin/index.php): failed to open stream: No
such file or directory in /home/berkolli/public_html/DjLuki/admin/case/case.php on line 77 W....
Problem With Headers
setcookie errors (5) I'm having troubles with my authentication function, if the the users uses wrong login info, it
works like a charm, but it gives me errors when i set the cookies, so help would be appreciated...
CODE Function auth(){ $user=$_POST['username'];
$pass=$_POST['password']; $qry="SELECT id from Solarity where
username='$user' and password='$pass'";
$result=mysql_query($qry) or die("A problem occured during authentication
process"); $....
Getting Rid Of Errors
(4) Hi Is it ok to use error-reporting(0) locally in a snippet of code that spits an undefined variable
error? I found that fix and was wondering what does everybody do about error messages that keep
poping up. Thanks Patrick....
Mysql Errors
cant find whats wrong :( (3) I am working on my guestbook, better to say I am transfuring it from old to new site, but I got some
errors now I did not had at my old hoster and I cannot figure out whats wrong: CODE
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
/home/pbrugge/public_html/guest.php on line 104 Warning: mysql_fetch_array():
supplied argument is not a valid MySQL result resource in /home/pbrugge/public_html/guest.php on
line 110 This is the complete relevant code perhaps I overlooked something but I keep ove....
Looking for fopen, errors, grrr, im, angry,
|
|
Searching Video's for fopen, errors, grrr, im, angry,
|
advertisement
|
|