HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=18)
-   -   Fix WebDAV with PHP (files execute instead of GET) (http://www.howtoforge.com/forums/showthread.php?t=43749)

Steveorevo 1st March 2010 13:57

Fix WebDAV with PHP (files execute instead of GET)
 
There is bug that I've come across when running ISPConfig 2.2.35 where getting PHP files via WebDAV pulls down the executed script vs. the actual PHP content.

To fix this problem you'll want to add directives via ISPConfig's Apache Directives (Optional) setting. I add the following that prevents PHP scripts from executing when downloading via WebDAV

# Fix for PHP WebDAV
<IfModule mod_dav.c>
<Location /webdav>
php_value engine off
</Location>
</IfModule>

WebDAV is an excellent alternative to FTP because it can be secure (with optional SSL), HTTP(S) is optimized on most routers and networks, and its fast as hell. Its also supported on various OS's natively from OS X to Windows, and in 'professional' web IDEs like Dreamweaver (for designers) and phpED (for developers). With this fix I can develop faster using Dw and www.themedreamer.com developing WordPress themes.

Steveorevo 26th October 2010 12:19

Additional fix for WordPress
 
Hey Guys, I just wanted to followup as I've been having new problems crop up with WordPress. Alot of clients use WebDAV and WordPress with its 'Permalinks' feature. It does this by using .htaccess rules. I noticed that cPanel clients don't have a problem but ISPConfig does.

Apparently cPanel creates a whole new sub-domain for webdav services webdav.yoursite.com (not a fan) with <Directory> directives of "AllowOverride None" to prevent even reading .htaccess.

In ISPConfig this won't work, as adding <directory> directives would then break WordPress's permalinks, and the <Location> directives parse after reading .htaccess (again, which is how WordPress does permalinks).

I found that to eliminate this problem, just add the line "Rewrite engine off" to the fix I had above. This will allow popular WordPress users with permalinks + WebDAV to work seamlessly. Sure beats having to login into WordPress's control panel, and then toggle permalinks on/off everytime one needs to upload a new file.

So the new fix would look like this:

# Fix for PHP WebDAV
<IfModule mod_dav.c>
<Location /webdav>
php_value engine off
Rewrite engine off
</Location>


Regards,
Steve

Steveorevo 26th August 2011 09:56

Nothing needs to be removed, rather, you should add the code above to the ISPConfig 2's "Apache Directives (Optional):" textbox on a site's definition.

WebDAV is fast, but note that it does have different file permissions then FTP. Uploading a file via WebDAV may prevent that file from executing with read/write proper privileges (i.e. having wordpress install plugins, etc.). A faster alternative to FTP and WebDAV is to use SSH as file system. If you are on a mac, using MacFUSE is ideal.


All times are GMT +2. The time now is 23:13.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.