Webdav and php

Using WebDAV in Windows Explorer works great, but when trying to copy a *.php file from the DAV folder on the website to my local system, the *.php file is parsed by the dreamhost server.
So I only get the resulting page instead of the *.php source.
Any ideas in solving this?

I’m getting PHP output rather than the source

This is caused by the simple fact that a GET is always going to run the script. There is no way to distinguish a “GET for the result” and a "GET for authoring."
Note: this problem applies to any server-side scripting solution. It is not specific to PHP. For demonstrations sake, I will use PHP as an example.

PHP and mod_dav will also conflict when they each attempt to handle the different HTTP request methods. This is caused by the simple fact that both modules are configured for the same location or directory, and are competing for acting as the content handler.

There are several ways to fix this. They all solve the problem by providing a separate URL to access the PHP source. In one scenario, you can provide a simple “source” URL:

[color=#0000CC]Alias /phparea /home/gstein/php_files
Alias /php-source /home/gstein/php_files
<Location /php-source>
ForceType text/plain

A different alternative is to present the source through another virtual server:

DocumentRoot /home/gstein/php_files

DocumentRoot /home/gstein/php_files
ForceType text/plain

There are probably a few, similar ways to accomplish the same kind of setup. I have used the first form (a secondary URL space) successfully, but have not tried the second virtual host. Other people have reported success with it, however.

In each of these ways to fix the problem, we are taking advantage of the fact that there are different URL namespaces that map to the same, underlying filesystem space. By attaching different processing to the URL spaces, we can create different behaviors during the translation to the filesystem space.

Finally, I believe that it may be possible to ensure that mod_dav occurs later in the AddModule directives, thus making mod_dav be the content handler for methods besides GET. If PHP is later in the list, then it will end up handling all methods. This trickery does not solve the authoring problem, however.[/quote]
Source : http://www.webdav.org/mod_dav/install.html

httpd.conf setup, maybe DH has already something in the works as specified above.

Thanks DaRkMaN, sounds like a straightforward solution.
I’ll ask Dreamhost, fingers crossed!

np :slight_smile:
/me crosses fingers 2

Cool, Dreamhost implemented it and it works great! I now have an alias /php-source pointing to my WebDAV folders, that handles all files like they are text sources. Thanks again.

Great, glad it worked out, a big thumbs up for DH :slight_smile:
Should be pretty straightforward to implement this functionality through the panel, a minor but still nice feature to have.