PDA

View Full Version : why i have this prob.


crel
09-03-2005, 06:10 PM
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 ?

Bart
09-05-2005, 01:52 AM
I would start by checking your php.ini file

jondale
09-06-2005, 04:02 PM
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).

Kevin
03-27-2006, 07:12 PM
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.