Forum Moderators: phranque

Message Too Old, No Replies

Problems getting PHP files via WebDAV

Problems getting PHP files via WebDAV

         

jamesgeldart

10:22 pm on Nov 16, 2007 (gmt 0)

10+ Year Member



I'm setting up a development server for a project which will be worked on by several people in different locations - therefore I want to use WebDAV to access the script directories.

The problem I've run into is that to download/open the files to edit them, the client needs to send a GET request to the server. But the server can't distinguish between the webDAV GET and a normal GET from a browser, which is obviously needed to run the scripts. So, when trying to open the scripts for editing via my WebDAV client, I find that they're actually being executed.

The ideal way around this problem would be to disable PHP depending on the user agent, but Apache doesn't seem to give an option for this. As an alternative, I've tried creating an alias to my script directory, and then a <Location> directive for this alias which contains the RemoveType .php directive - this doesn't work (actually RemoveType doesn't seem to work at all...)

Any ideas or do I need to go back to using FTP to do this?

The server is running Apache 2.2.3 and PHP 5.1.6 on CentOS

Thanks
James

jamesgeldart

10:35 pm on Nov 16, 2007 (gmt 0)

10+ Year Member



Ah I've solved it myself, by the method of using an alias. RemoveType didn't work, but switching off PHP for the /dav alias using 'php_value engine off' did. Here's the portion of my httpd.conf in case anyone else is trying to do something similar (and yes I know I should be using digest authentication, but that's another story...)

# webdav access to /dev

<Location /dev>
Order Allow,Deny
Allow from all
Dav Off

AuthType Basic
AuthName "Development Server"
AuthUserFile /var/www/auth/.basic_pw

Require valid-user

</Location>

alias /dav /var/www/html/dev

<Location /dav>
Order Allow,Deny
Allow from all
Dav On

AuthType Basic
AuthName "Development Server"
AuthUserFile /var/www/auth/.basic_pw

Require valid-user

php_value engine off

</Location>