• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1033
  • Last Modified:

Enabling PUT commands on Xampp Apache

We have a small new development setup running Xampp Apache, PHP , MySQL.

When trying to send PUT commands we get a browser response  "Service  -  Method not allowed"

I"m told its likely just an Apache config issue but struggling to find the right info to fix it

Thanks for any help in advance
0
webfactor
Asked:
webfactor
1 Solution
 
Ahmed MerghaniCommented:
I do not think you need to do Apache configuration. I think you are calling a web service method. Kindly, post your code so we can try to help you.
0
 
webfactorAuthor Commented:
The scenario is, we use the Apache server to call on another "Windows 8" machine which hosts a product called InControl , a home automation control software .. docs are :

http://developer.incontrolha.com/json-api.aspx    and the website http://store.incontrolzwave.com/incontrol-home-automation-software-download 

The code used in the PHP file on the apache server is

$url="http://".$host.":".$port."/zwave/getScenes/?password=".$pass;

$ch = curl_init() or die(curl_error());
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PUT, true);


$data1=curl_exec($ch) or die(curl_error($ch));


Perhaps it is being blocked at the Windows machine instead?

Any extra info you need let me know and thanks again
0
 
webfactorAuthor Commented:
Oh and the exact PUT request we are trying is on this page

http://developer.incontrolha.com/json-api/scene-retrieve-list.aspx
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
Ahmed MerghaniCommented:
Change your curl part to be something like this:
$url="http://".$host.":".$port."/zwave/getScenes/;

$param= array("password" => $pass);

$ch = curl_init() or die(curl_error());
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($param));


$data1=curl_exec($ch) or die(curl_error($ch));

Open in new window

0
 
webfactorAuthor Commented:
after running your suggested code we get following error:
Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.
Error 500
0
 
Ahmed MerghaniCommented:
Sorry forget to enclose the string in the first line:
$url="http://".$host.":".$port."/zwave/getScenes/";

Open in new window

0
 
webfactorAuthor Commented:
same error agian
0
 
webfactorAuthor Commented:
the server error was our msitake,after fixing that we r back to square one error Method not allowed
0
 
webfactorAuthor Commented:
Also FYI we were following the suggestions here:  

http://www.evardsson.com/blog/2010/04/27/apache-and-php-http-put-voodoo/
0
 
Ahmed MerghaniCommented:
Perhaps it is being blocked at the Windows machine instead?
I realized this! Yes may be. Did you try to use any other method other than "PUT"? For example "GET"?
You can try any REST client to ensure if its blocked by the Windows machine or not. If you are using firefox browser, then you can download and install REST Easy or RESTClient plug-in. Try "GET" method for any resource and if succeed, then try "PUT" and show the result.
0
 
Dave BaldwinFixer of ProblemsCommented:
Here http://www.apacheweek.com/features/put is info on enabling PUT.  You have to enable the protocol and have a program that handles the request.  Apache itself is not going to do it.  In addition, PUT is normally protected by a username/password login so that only authorized sources can PUT a file on the server.
0
 
shalomcCommented:
As far as I understand, the problem you have is with php code running on your xampp server. Said code is trying to contact the incontrol software via PUT.
Did I get it right?

If that is the case, then your problems have nothing to do with enabling PUT on your Apache, rather with communications between Apache+php code and the control software.

Can you use command line CURL from your xampp server to send PUT commands to incontrol?
0
 
webfactorAuthor Commented:
Thanks everyone for your comments, we ended up being able to perform the functions we need using GET commands instead
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now