fopen() question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • acorn71

    #1

    fopen() question

    hello, i just recently started getting permission errors when writing
    to a file that's been working fine for a couple weeks now. i have made
    no changes to the file or folder permission settings and i was
    wondering if anyone knew of any other factors that could cause these
    types of errors below. thanks in advance for a help with this problem.
    aaron;

    $content = "my file content";

    // create a filename variable with the .iif extension for Quick Books
    $filename = "qbprod.iif ";

    // delete old file so a new file can be created
    unlink($filenam e);

    // create a new file
    $handle = fopen("/home/mysite/www/qbdata/$filename", 'a');

    // write the contents to the file
    fwrite($handle, $content);

    // have dialog box prompt the user to open or save the file
    header("Locatio n:
    http://www.mysite.com/qbdata/get_file.php?fi lename=$filenam e");

    Warning: Unlink failed (No such file or directory) in
    /home/www/mysite/qbdata/get_product_dat a.php on line 112

    Warning: fopen("/home/goknobs/www/qbdata/qbprod.iif", "a") - Permission
    denied in /home/www/mysite/qbdata/get_product_dat a.php on line 115

    Warning: Supplied argument is not a valid File-Handle resource in
    /home/www/mysite/qbdata/get_product_dat a.php on line 118

    Warning: Cannot add header information - headers already sent by
    (output started at /home/www/mysite/qbdata/get_product_dat a.php:112) in
    /home/www/mysite/qbdata/get_product_dat a.php on line 121

  • Slant

    #2
    Re: fopen() question

    Did you TRY to reset the folder permission, by chance? Also, is this
    being hosted on your own personal system or is it leased space? If it
    is not your own system, they may be working on something. Just a
    thought.

    Comment

    • acorn71

      #3
      Re: fopen() question


      Slant wrote:[color=blue]
      > Did you TRY to reset the folder permission, by chance? Also, is this
      > being hosted on your own personal system or is it leased space? If it
      > is not your own system, they may be working on something. Just a
      > thought.[/color]

      i found out it was something to do with apache assigning the file with
      "nobody" permissions. not sure why it started do that out of the blue,
      but the host fixed the problem.

      aaron;

      Comment

      • rovisoft

        #4
        re:fopen() question

        Well this may be happening because of some server updates, you should
        check beside permissions also if you still own those files, meaning
        you should check the user and group those files are associated with!

        If you are hosted by a third party try contacting them to fix the
        problem!

        Hope it helps, Ovidiu

        Comment

        Working...