Thread: fput function.

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Belgium
    Posts
    7
    Rep Power
    0
    Hi all,

    I made a script for logging the emails that they send on my site. It works fine on windows 98 version, but when I upload it to a Linux computer it fails.

    Here are the first lines of the script:

    $file = fopen("log/index.html", "a+");
    $today = date("G:i, l jS Y");
    if ($argv[0] == "contact")
    {
    if ($name == "")
    {
    fputs($file, "Text comes here";
    fclose$file);
    }

    Then the output is:

    Warning: fopen("log/index.html","a+") - Permission denied in /home/jonathan/public_html/beftubbies/email.php3 on line 3

    Warning: Unable to find file identifier 0 in /home/jonathan/public_html/beftubbies/email.php3 on line 30

    Warning: Unable to find file identifier 0 in /home/jonathan/public_html/beftubbies/email.php3 on line 31

    Thank you.

    -Jonathan
    http://www.sterkwater.net/~jonathan/beftubbies
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    Netherlands
    Posts
    77
    Rep Power
    16
    If you want to open a file to write to it, try the "w" argument, like:

    $file = fopen("log/index.html", "w");

    Peter
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 1999
    Location
    UK
    Posts
    50
    Rep Power
    16
    Its just a suggestion but have you modified the access rights the file and directory. It needs to enabled so that a web user can read and write from them.

    In linux use the commands : chown & chmod

    Hope this helps

    Falcon
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Belgium
    Posts
    7
    Rep Power
    0
    >In linux use the commands : chown & chmod

    That was the first thing I did when I uploaded it.
    Now I tried with fopen("log/index.html","w")
    but...

    Warning: fopen("log/index.html","w") - Permission denied in /home/jonathan/public_html/beftubbies/email.php3 on line 3

    -Jonathan http://www.sterkwater.net/~jonathan/beftubbies
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    Netherlands
    Posts
    77
    Rep Power
    16
    That's very strange
    It seems you're not able to write to your own files. Did you do a chmod 755 or 644 on the file?

    Peter

Similar Threads

  1. undefined function
    By radiofreedom in forum PHP Development
    Replies: 7
    Last Post: May 7th, 2004, 10:39 AM
  2. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 17th, 2004, 12:21 AM
  3. database access using thread
    By padmini in forum Visual Basic Programming
    Replies: 3
    Last Post: February 6th, 2004, 01:38 AM
  4. Code Benchmarking Tests
    By infamous41md in forum C Programming
    Replies: 4
    Last Post: December 27th, 2003, 05:15 PM
  5. class boolean
    By dbrag in forum C Programming
    Replies: 7
    Last Post: December 11th, 2003, 03:25 PM

IMN logo majestic logo threadwatch logo seochat tools logo