PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Cannot create a file using php on appache web server
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Cannot create a file using php on appache web server

Réponse
 
LinkBack Outils de la discussion
Vieux 13/09/2007, 21h15   #1
tedpottel@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Cannot create a file using php on appache web server

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???

  Réponse avec citation
Vieux 13/09/2007, 21h26   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Cannot create a file using php on appache web server

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???
>


*Permission denied*

That tells you right there what the problem is. The web server user
doesn't have the authority to open the file.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
Vieux 13/09/2007, 21h46   #3
Erwin Moller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Cannot create a file using php on appache web server

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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h05.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10075 seconds with 11 queries