Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Resolve Apache2 WebDAV and PHP conflict per Location' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Resolve Apache2 WebDAV and PHP conflict per Location
Authored by: snark on Jan 27, '05 04:39:33AM
Only that RemoveType does not work on directory or location sections - only per (virtual) host (at least for Apache 2 up to 2.0.52 currently ...) I ran into that problem last week actually.

The only reliable solution i found for Apache2 servers that shall process php in some locations and present unprocessed php in DAV locations is ForceType text/plain. If you want to retain other mime type associations, you can wrap it into File sections to only force text/plain on special extensions:


<Location /xyz>
  DAV on
  <File .php>
    ForceType text/plain
  </File>
  <File .phtml>
    ForceType text/plain
  </File>
...
</Location>
make sure, you catch all of the extensions you want to treat...

[ Reply to This | # ]
Have your cake and php too with aliases
Authored by: bo3behemoth on Sep 15, '05 01:08:23PM
I've been having the same difficulties. Turning off php and other server side scripting stuff is fine, but not if you're trying to edit a php file remotely that you then want others to use. Using aliases you can do both.

From the Apache mod_dav documentation:

======================

Complex Configurations One common request is to use mod_dav to manipulate dynamic files (PHP scripts, CGI scripts, etc). This is difficult because a GET request will always run the script, rather than downloading its contents. One way to avoid this is to map two different URLs to the content, one of which will run the script, and one of which will allow it to be downloaded and manipulated with DAV.


Alias /phparea /home/gstein/php_files
Alias /php-source /home/gstein/php_files
<Location /php-source> DAV On
      ForceType text/plain
</Location>
With this setup, http://example.com/phparea can be used to access the output of the PHP scripts, and http://example.com/php-source can be used with a DAV client to manipulate them.

[ Reply to This | # ]