tracdoor 0 Report post Posted April 10, 2008 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); <?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: There have been <?php include ("/home/tracdoor/public_html/counter.php"); ?> hits. It says:Warning: fopen(hitcounter.txt) [function.fopen]: failed to open stream: Permission denied in /home/tracdoor/public_html/counter.php on line 5Can anyone find a way around this? or am i stuck? Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted April 10, 2008 Exactly what permissions does the file have? 777?And are all of the files contained in the public_html folder? Share this post Link to post Share on other sites
tracdoor 0 Report post Posted April 10, 2008 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 Share this post Link to post Share on other sites
truefusion 3 Report post Posted April 11, 2008 I think it may have to do with the fact that open_basedir is enabled in Xisto. 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". Share this post Link to post Share on other sites
tracdoor 0 Report post Posted April 11, 2008 No, that didn't work, is there anyway around it? or am i just stuck? Share this post Link to post Share on other sites
truefusion 3 Report post Posted April 12, 2008 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. Share this post Link to post Share on other sites
Framp 0 Report post Posted May 26, 2008 It looks like there're problems with fopen.Try to call the support Share this post Link to post Share on other sites
jmark 0 Report post Posted November 20, 2008 $doesthiswork = "/home/tracdoor/public_html/hitcounter.txt";if (!is_writeable($doesthiswork)){echo 'The file is not writable';}test your file by using those code.Darren Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 23, 2009 file not open in phpFopen Errors I m try to open file in php using fopen in write mode. it give errorĀ as follow Warning: fopen(/detail.Txt) [function.Fopen]: failed to open stream: No error in C:phptesttesttestfile.Php on line 7 I musing vsphp trial version as ide -reply by alpeshKeywords: warning: fopen(/detail.txt) [function.fopen]: failed to open stream: no error in in php Share this post Link to post Share on other sites