Jump to content
Xisto Corporation
Sign in to follow this  
leiaah

What Does This Error Mean? on files and streams

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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... :D feel free to contact me if you do not understand what I've tryeed to explain here... :D

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.