www.webdeveloper.com
Results 1 to 6 of 6

Thread: discussion board fopen error

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    33

    Exclamation discussion board fopen error

    I'm trying to create a discussion board, everything works fine on my computer but when I upload it to the godaddy server and try to post something, this error comes up:

    Warning: fopen(messages.txt) [function.fopen]: failed to open stream

    I have a txt file that stores all the data from the discussion board. I did try to create that messages.txt file on godaddy, but still get the same error.

  2. #2
    Join Date
    Mar 2010
    Posts
    672
    Make sure the file has the appropriate permissions and is actually within the same directory as the script (since you haven't specified otherwise in the code).
    On a side note, i'd highly (very highly) recommend moving to a database based message board system. Using a plain text file is going to get very messy very fast for all but the simplest of boards (aka something closer to a chat room). It may seem daunting at first, but using a database will, in the end, make your development a lot easier and allow the boards to scale better.

    Edit: Also, is that all of the error you received? Usually the "failed to open stream" is follow by a reason of why it failed.
    Last edited by Jarrod1937; 07-18-2010 at 01:43 PM.

  3. #3
    Join Date
    Apr 2009
    Posts
    33

    hey

    This was the entire error. The messages.txt file is in the right place and as far as I can see, the permissions are correct. This works on my computer but not when I upload it to the godaddy server. So it's something to do with the server. I know about the databases, but I'm very new to php and want to work my way into the more complicated stuff. This discussion board is very small, mainly just for practice.

    Warning: fopen(messages.txt) [function.fopen]: failed to open stream: Permission denied in D:\Hosting\3302344\html\mmwd\Board\PostMessage.php on line 54

    Warning: fwrite(): supplied argument is not a valid stream resource in D:\Hosting\3302344\html\mmwd\Board\PostMessage.php on line 55

    Warning: fclose(): supplied argument is not a valid stream resource in D:\Hosting\3302344\html\mmwd\Board\PostMessage.php on line 56

  4. #4
    Join Date
    Mar 2010
    Location
    Singapore
    Posts
    367
    Quote Originally Posted by justbringit85 View Post
    Warning: fopen(messages.txt) [function.fopen]: failed to open stream: Permission denied in D:\Hosting\3302344\html\mmwd\Board\PostMessage.php on line 54

    Warning: fwrite(): supplied argument is not a valid stream resource in D:\Hosting\3302344\html\mmwd\Board\PostMessage.php on line 55

    Warning: fclose(): supplied argument is not a valid stream resource in D:\Hosting\3302344\html\mmwd\Board\PostMessage.php on line 56
    On your Windows PC you have your D:\ drive and folder but when you upload to the GoDaddy which maybe using Unix or Linux, D:\ cannot be understood. It is always best to work with relative path then absolute path when you play around between Windows and Unix/Linux.

  5. #5
    Join Date
    Jan 2009
    Posts
    3,346
    Check that the directory you are writing to has adequate permissions for the script to write to.

  6. #6
    Join Date
    Apr 2009
    Posts
    33

    ok

    I guess I didn't have my godaddy permissions set right. I went and was able to allow my site to read and write. It was on inherit. Now the discussion forum works perfectly. Thank you all for helping me out with this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles