www.webdeveloper.com
Results 1 to 6 of 6

Thread: PHP Warning

  1. #1
    Join Date
    Jul 2011
    Location
    Irish Republic
    Posts
    64

    Arrow PHP Warning

    I am trying to test the ArdGuest - Free PHP Guestbook Script on a production server before installing on website.
    I get the fllowing PHP Warning: fopen(ardgb18.dat) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in C:\CustomerData\shopdemo.webitry.net\index.php on line 419

    View at www.shopdemo.webitry.net\index.php
    I have marked line 419 in the code below.

    Code:
    if (!is_spam($newdata)) {
     line 419	        $tambah = fopen($data_file,"a");
    		if (strtoupper($os)=="WIN") {
    			if (flock($tambah,LOCK_EX)) {
    				fwrite($tambah,$newdata);
    				flock($tambah,LOCK_UN);
    			}
    What is causing the error and how can it be corrected?

  2. #2
    Join Date
    May 2010
    Posts
    77
    Usually when I get that error it's because the www-data group does not have write permissions to a file or directory.

    Can you see and change the file or directory permissions on this server?

  3. #3
    Join Date
    Jul 2011
    Location
    Irish Republic
    Posts
    64
    Thanks , Write permissions sorted the problem. Why does the PHP warning not tell us aout the write permissions in simple language?

  4. #4
    Join Date
    Jan 2009
    Posts
    3,346
    Quote Originally Posted by webiter View Post
    Thanks , Write permissions sorted the problem. Why does the PHP warning not tell us aout the write permissions in simple language?
    I think "failed to open stream: Permission denied" is about as plain as it could be stated IMHO.

  5. #5
    Join Date
    May 2010
    Posts
    77
    Quote Originally Posted by criterion9 View Post
    I think "failed to open stream: Permission denied" is about as plain as it could be stated IMHO.
    Actually something like "failed to open file because www-data doesn't have write permissions" would be as plain as it can be stated. :-)

    I mean the first time I encountered that error I was wondering why I didn't have permission because I was logged in as a root user. I know it now but I can't think of one error message from PHP or any other language that is stated in plain English. It just takes time learning the error language like learning the syntax of the code.

  6. #6
    Join Date
    Jul 2011
    Location
    Irish Republic
    Posts
    64
    Great that you understand. Thanks.

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