HOME       >>       Programming

What Does This Error Mean? on files and streams


leiaah

Can anyone help me with this error?Warning: fopen(guests\guest.txt): failed to open stream: Permission denied in /home/leiaah/public_html/images/goguest.php on line 28Warning: flock(): supplied argument is not a valid stream resource in /home/leiaah/public_html/images/goguest.php on line 30This is part of the code I wrote // open file for appending $fp = fopen("guests\guest.txt", 'a'); flock($fp, LOCK_EX); This works well with my offline server but I'm having the error after I published it and when I view it online. Help!


finaldesign

Can anyone help me with this error?

 

Warning: fopen(guests\guest.txt): failed to open stream: Permission denied in /home/leiaah/public_html/images/goguest.php on line 28

50361[/snapback]


Hello there.. Now this is easy. The problem is in file permission system. When you run it on your computer (with server installed) it works because you are administrator of computer, and you have all access rights... On the other hand when you upload code and file guest.txt to web hosting server you must give pleople public access to that files, now *.php files are by default accessible, but you must give an access to that GUEST.TXT file where you write via php page...

 

Now, how you can do that? If you know how to use unix/linux it's pretty easy, but if you login to you Xisto cpanel you must change it via filemanager, or alternatively you can use some of FTP clients to do that directly on server...

 

Example: connect to your webhost server on Xisto via some FTP program (like CuteFTP) and rightclick on file guest.txt and choose CHMOD... (in some other FTP program thing's may be different, but this is generaly same....) then change chmod into number 777 - that way anyone will gain access to that file... I assume it's your guestbook... feel free to contact me if you do not understand what I've tryeed to explain here...


leiaah

Thanks I've set the permission already. But again I'm having a few troubles with the same line of code// open file for appending $fp = fopen("guest.txt", 'a'); flock($fp, LOCK_EX); guest.txt and the php file reside on the same folder so what do you think is the problem? Thanks again.


leiaah

It works already thanks a lot! I'll give you reputation.



VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.