Reply to Re: Weird Troubles Writing to File

Your name:

Reply:


Posted by tihu on 05/06/06 00:55

Jolly Green Giant wrote:
> I'm trying to use PHP to create a text file. Simple right? I've done
> it before. I don't know why it's not working now. It's not rocket
> science. In general, I'd say I'm a PHP beginner, but with an
> intermediate skill level in certain facets of the language.
>
> $thisFileName = 'test.txt';
> $fp = fopen($thisFileName, "w");
> $write = fputs($fp, "test");
> fclose($fp);
> if (!file_exists($thisFileName))
> die("File does not exist.");
>
> * This script is in the same directory as the text file.
> * I am on a Windows server.
> * The permissions for the folder I'm in, and the files, is 666
> (read/write).
> * I have tried using just the file name and also the full path.
>
> I can modify that script to do a READ instead of a write, and set the
> filename to a file that exists already.... it works just fine. But
> even if I leave the filename to a file that exists, and try the above
> script to write over it... it won't work.
>
> How can I find out what the problem is? I'm not getting any PHP error
> info on browser. I guess they have debugging turned off.
>
> Thanks for any help!
>
> --
> JGG

Sorry, not sure what the problem is.

You should be able to turn error messages on with error_reporting(),
use

error_reporting(E_ALL);

Another thing you could try is cut n paste the script in the php manual
for fwrite (its identical to fputs) as it checks for errors after each
step and it might tell you where the problem is.
http://www.php.net/manual/en/function.fwrite.php

Seeya

Tim

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация