Welcome! Log In Create A New Profile


PUT method support

Posted by mnadolski 
PUT method support
January 05, 2010 08:58AM
Hi there,

I'd prefer to use Nginx instead of Apache here http://www.php.net/manual/pl/features.file-upload.put-method.php
Only thing I need is support for PUT method.
I tried
PUT /file.ext HTTP/1.1
Content-Length: 3


but only thing I get is

HTTP/1.1 400 Bad Request
Server: nginx/0.7.64
Date: Tue, 05 Jan 2010 13:28:01 GMT
Content-Type: text/html
Content-Length: 173
Connection: close

<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>

What I am missing? I tried many aproches (including passing to FastCGI). Does someone know how to do this?

Can Nginx be used instead of Apache to handle PUT requests in PHP?
Re: PUT method support
April 12, 2010 04:33PM
hello can you put some of you PUT Script?

i will try to add a PUT request handle to nginx, so you can use it, i have the same problem in one of my projects.

i hope i can help you in the next days/weeks
Re: PUT method support
April 12, 2010 05:11PM
Okay also i have found my problem.

Its the PHP Script, but now i get

405 Not Allowed

my Script to PUT:


* @author DeineAgentur UG
* @copyright 2010

$url = "http://www.test.local/create";
$localfile = "create.xml";

$fp = fopen ($localfile, "r");
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_USERPWD, 'user:password');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));

$http_result = curl_exec($ch);
$error = curl_error($ch);
$http_code = curl_getinfo($ch ,CURLINFO_HTTP_CODE);


print $http_code;
print "<br /><br />$http_result";
if ($error) {
print "<br /><br />$error";

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 82
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready