httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <Owen.Bo...@swx.com>
Subject RE: [users@httpd] php scripts unable to write to a file
Date Wed, 18 Sep 2002 07:35:35 GMT
Apache runs with the access rights of the user defined by "User". To write to a file, apache
needs write permissions:

- if the file already exists (like a logfile) and you are doing an append in your script -
open(FILE, ">>$filename") - then apache needs write access to the file. There are several
ways to ensure this:

	- make the file owned by apache
	- make the file group-writeable where apache's group is the sasme as the file-owner's group
	- make the file group-writeable and add the file-owner's group to apache's group list
	- make the file writeable by "others" (last resort)

read the man pages for chown, chmod, usermod to learn how to do these.

- if you want to create the file, apache needs write access to the *directory* that the file
will go in. Proceed as above but with the directory...

Think carefully about what is happening and apply the minimum permissions necessary to acheive
what you want - this is better than just making everything worlfd-writeable..

>-----Original Message-----
>From: Mr OCP [mailto:mr_ocp@hotmail.com]
>Sent: Dienstag, 17. September 2002 22:26
>To: users@httpd.apache.org
>Subject: [users@httpd] php scripts unable to write to a file
>
>
>Hi
>
>I have webpages using php whcih read from and write to files, 
>it can read 
>from files and display the info, but it cannot write to the 
>files, I have 
>issued chmod 777 *, change the ownership of the files to 
>apache user, still 
>does not work, here is a snipp from my httpd.conf file
>
>------Snipp-------
>
>    # To use CGI scripts:
>    #
>    AddHandler cgi-script .cgi .pl
>    AddHandler php-script .php
>    AddHandler php-script .php3
>    AddHandler php-script .php4
>
>    #
>    # To use server-parsed HTML files
>    #
>    #AddType text/html .shtml
>    #AddHandler server-parsed .shtml
>
>    AddType application/x-tar .tgz
>    AddType application/x-httpd-php .php
>    AddType application/x-httpd-php .php3
>    AddType application/x-httpd-php .php4
>    AddType application/x-httpd-php-source .phps
>
>------Snipp-------
>
>Your help is appreciated
>Mike
>
>
>
>_________________________________________________________________
>Join the world's largest e-mail service with MSN Hotmail. 
>http://www.hotmail.com
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP 
>Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message