You are here: Re: fopen - append works, write fails (but file is truncated) « PHP Programming Language « IT news, forums, messages
Re: fopen - append works, write fails (but file is truncated)

Posted by Jerry Stuckle on 07/28/07 01:24

Hans Fredrik Nordhaug wrote:
> On 2007-07-27, Jerry Stuckle wrote:
>> davidkruger@techie.com wrote:
>>> On Jul 27, 12:00 pm, Hans Fredrik Nordhaug <han...@gmail.com> wrote:
>>>> I'm trying to write to a file in the current directory - no remote
>>>> files. The subject says it all - I can add that both the directory
>>>> and the file is wordwritable. This happens on a (quite good) free
>>>> hoster in Norway which doesn't use safe mode, running PHP 5.1.6 as the
>>>> PHP info below shows ...
>>>>
>>>> Test it at:
>>>> http://home.no.net/moldevbk/fopen-test/?mode=w (write - fails)
>>>> http://home.no.net/moldevbk/fopen-test/?mode=a (append - ok)
>>>> http://home.no.net/moldevbk/fopen-test/p.php - PHP info
>>>> http://home.no.net/moldevbk/fopen-test/fopen-test.phps - source
>>>> code of test script.
>>>>
>>>> I have searched the web and usenet, but not found this problem
>>>> mentioned before. I do realize that I can work around the problem by
>>>> truncating the file first and then appending to the empty file - but
>>>> that is ugly as ...
>>>>
>>>> Regards, Hans
>>>>
>>>> --
>>>> + It's GNU/Linux, not Linux ->http://www.gnu.org/gnu/linux-and-gnu.html
>>>> + Support the Free Software Foundation ->http://member.fsf.org/
>>>> + Become an Open Directory Project Editor ->http://dmoz.org/
>>> make sure the directory is set to allow group writing with permissions
>>> set to 707. then it shoudl allow it to work.
>>>
>> 707 is NOT a good one to use. It means anyone can write to the file.
>> And if it's not an executable file, you shouldn't have the execute bit on.
>>
>> 600 is great if the webserver is going to be the only one accessing it;
>> Otherwise you should use 660 with the proper group settings.
>
> Come on guys - as the URL http://home.no.net/moldevbk/fopen-test/
> shows the execute bit isn't set for the file, only for the directory
> (where it's needed). And if you pay even more attention to what I
> wrote (and the URL above shows), you'll notice that
> 1) this is free hoster so I can't change how the groups are setup
> 2) you have to allow anyone (666) to write to the file because nobody
> (the web server user) isn't member of the users group.
>
> Anyway, thx for your time.
>
> Hans

0) I wasn't responding to you - I was responding to David.
1) You get what you pay for. Get a decent host.
2) See 1).

You can get good hosts very inexpensively. You want free? All you're
doing is trading a monthly bill for your time.

And quite frankly, you can't buy much of my time for $3-5/mo. Or even
the $25-40/mo. I pay for vps's.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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