You are here: Re: Cannot create a file using php on appache web server « PHP Programming Language « IT news, forums, messages
Re: Cannot create a file using php on appache web server

Posted by Erwin Moller on 09/13/07 20:46

tedpottel@gmail.com wrote:
> Hi,
>
> I have a local webserver/php develpment system running under windows
> xp,
> the following line works fine
> $handle = fopen("ted.txt", "w");
>
> but when I try to run it on my hosting account, it gives me the
> following error
> Warning: fopen(ted.txt) [function.fopen]: failed to open stream:
> Permission denied in /home/allthing/public_html/test.php on line 13
> coulf not open file
>
> On a uniz web server how do I set the file permissions???
>

Hi Ted,

What is a 'uniz web server'?
I never heard of that brand before.

But since your subject says appache (should be Apache, 1 p), my best
guess is you want to know how to set file permissions on a Unix machine
(which probably is Linux, not Unix), that happens to run Apache web server.

blah blah, I must bore you. ;-)

To the point then: How to change permissions on a file under *nix?
in short: chmod

log in, then chmod the file you want to change.

Read more here for example:
http://en.wikipedia.org/wiki/Chmod

You must first find out who must be able to write to the file: In your
case this is the user that runs PHP/Apache.
This user is often called 'www-data' or 'nobody' or 'apache'.
Hard to tell from this distance.

If you don't care about security, you can chmod it to 777, opening up
the file to the world for writing, reading and executing.
Nice for a quick test, bad to leave it that way.

Regards,
Erwin Moller

 

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

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