[thelist] writing to file in php problem

Mike Migurski mike at saturn5.com
Mon Jan 6 17:17:17 CST 2003


>> Hard to say without more info - the file gets created? It turns up
>> empty?
>> What's the return value of fputs()?
>>
>> I tried it here, and of course it worked fine. What are the
>> permissions of
>> the directory you're in?
>
>The permissions are 777. I created the file empty and placed it in my
>directory, so its there. (This is how I did it before.)
>
>Removing the file gives me errors, I assumed the file had to be there
>first.
>
>Doing this: $x = fputs($handle, $string);
>
>Gives me the value: 13
>
>Does that help? I know the code should work, in fact the other pages
>that use this code are even in the same directory and are currently
>working.

Somewhat.

fopen() with the mode set to 'w+' should create the file if it doesn't
exist, so if it's throwing errors right off the bat, that's probably an
issue right there. On the other hand, the '13' you're getting back from
fputs() refers to the number of bytes written, which is correct (13 chars
in <html></html>). If you have created the file to begin with, ar you sure
that the file's permissions are set to 666 at minimum?

What OS are you running?

-mike.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
                 http://www.saturn5.com/mike/contact.html

                "Freedom! Horrible, horrible freedom!"







More information about the thelist mailing list