+ Reply to Thread
Results 1 to 4 of 4

Thread: why i have this prob.

  1. #1
    Junior Member
    Join Date
    Sep 2005
    Posts
    1

    Default why i have this prob.

    simple php code, working at every host, but here i have problems :(, maybe any 1 can help.
    code:
    -------------------------------------------
    $filename = "mail.txt";
    if(!file_exists($filename))
    {
    echo ("create file:$filename
    ");
    $fp = @fopen($filename, "w");
    fputs ($fp, $killmail);
    @fclose ($fp);
    }
    -------------------------------------------
    and errormessage what showed to me with fputs and fwrite functions:
    Warning: fputs(): supplied argument is not a valid stream resource in /hsphere/local/home/..../eve-lc.com/write.php on line 12

    how solve problem ?

  2. #2
    Junior Member
    Join Date
    Aug 2005
    Location
    New Jersey
    Posts
    4

    Default

    I would start by checking your php.ini file

  3. #3
    Junior Member
    Join Date
    Aug 2005
    Posts
    4

    Default

    My first guess is a permissions problem.
    Are you running this code through a web browser or at the command-line?

    If through a web browser then does the user that the webserver is running as (httpd) have access to write to the directory?

    If you are the owner of the directory then you will have to give public write access to it (albeit that's not an advised solution on a shared hosting server).

  4. #4
    I love LAMP.
    Join Date
    Jul 2004
    Location
    Chicago, Illinois, United States
    Posts
    201

    Default

    Try removing the @ sign before the fopen function call so you actually see the error that was caused by the fopen command. fputs is failing because fopen failed, but the @ sign suppresses the error output.
    Kevin Stange
    Chief Technology Officer
    Steadfast Networks
    http://steadfast.net
    kevin@steadfast.net

+ Reply to 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