Thanks Michael and Peter for following this thread. It's finally solved. It was still mod security issues and a bit of .htaccess rules to forward the request accordingly.
2 mod security rules were blocking the requests:
ID 1234123435
ID 1234123429
Disable them or modify them. I disabled them.
To sum up for future reference:
This is the include file for the vhost to enable PUt method:
Code:
<Directory /path/to/specific/folder/to/handle/put/requests>
<Limit PUT GET POST DELETE HEAD OPTIONS>
Order allow,deny
Allow from all
</Limit>
</Directory>
This is the .htaccess content (with basic auth):
Code:
AuthType Basic
AuthName "Your title"
AuthUserFile "/path/to/passwd"
require valid-user
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.+$ - [NC,L]
RewriteCond %{REQUEST_METHOD} (PUT|DELETE)
RewriteRule .* put.php
This is the put.php file that will handle the PUT request:
PHP:
$putdata = fopen("php://input", "r");
$file="your_filename.txt";
$fp = fopen($file, "w");
while ($data = fread($putdata, 1024)){
fwrite($fp, $data);
}
fclose($fp);
fclose($putdata);
Everything has to be in the same folder or update your paths accordingly.