You are here: Re: Try to write files using php5 on Linux « PHP Programming Language « IT news, forums, messages
Re: Try to write files using php5 on Linux

Posted by SOR on 07/22/05 20:17

<comp.lang.php , Matthias Braun , mat_braun@web.de>
<42e11121$0$16777$9b4e6d93@newsread4.arcor-online.net>
<Fri, 22 Jul 2005 17:30:41 +0200>

> I am using SuSE 9.3, php5 and Apache2 on Linux. I try to write files to
> the hard drive using the following command:
>
> $filename = "test.txt";
> if (!file_exists($filename))
> touch($filename);
> if (is_writable($filename))
> $myfile = fopen( $filename,'w+');
> else
> {
> echo "Cannot write to file ($filename)";
> exit(1);
> }
>
> The script neither creates a file nor open it for writing. When using
> the same script on Windows everything works fine so I think it is a
> permission problem.
>

touch($filename); chmod($filename, 0766);

TMK once you create a file you need to chmod it before you can write to
it and what the folder (if any) is chmodded to is also important for non
windows hosting .

 

Navigation:

[Reply to this 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

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