POST request with PHP file in Azure Web App

php

#1

Hello Community,
I have a question.
I have index.php file in structure folder like this : http://massplannertom.azurewebsites.net/api/ExternalApi/InitializeClientz/
and it contain only json content.

I want index.php file host in azure website recieve POST request from client written in .NET and respond with content in that PHP file, that json content

I have added web.config in wwwroot with following structure :slight_smile:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <remove name="PHP53_via_FastCGI" />
      <add name="PHP53_via_FastCGI" path="*.php" 
verb="GET,PUT,POST,DELETE,HEAD,OPTIONS,TRACE,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK" 
modules="FastCgiModule" scriptProcessor="D:\Program Files (x86)\PHP\v5.3\php-cgi.exe" 
resourceType="Either" requireAccess="Script" />
    </handlers>
  </system.webServer>
</configuration>

But when running client tools, Fiddler show HTTP 405 “Method Not Allowed” , > The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used. Which is not support POST request.

How can index.php serve POST request from client tools running in window ?

Thanks in advanced !


#2

So for starters, i’m pretty sure this falls under a different category than the one you’ve selected.

However, Can you show the browser request that’s being rejected from the developer tools? I have a sneaking suspicion that you’re not actually getting as far as the POST request…


#3

Ok thanks I will move it to properly categories !

btw, this is fiddler debug show :

I used free tire in azure ! I have change file to many extension : aspx,php,json,… but not work !


#4

Well according to that screenshot, the server is only set to accept GET,HEAD,OPTIONS,and TRACE. So wherever you’ve put this config file, it’s either incorrect or not being read, or the server needs to be restarted to pick up the new configuration.


#5

Oh thanks I’ll restart and inform you !
Thanks !


#7

Hello,
I have restarted but still the same error !
I restarted app like this

image

Should I restart server too ! I don’t know where to restart server , it has only delete option


#8

Hello, Anyone help me here ?


#10

https://stackoverflow.com/questions/40231895/can-you-update-the-web-config-file-for-an-azure-web-app-without-redeploying Seems to be the question you’re asking.


#11

I suspect you might be better asking in the server configuration / hosting sections, this isn’t really anything to do with PHP code as far as I can see. While the issue is that your PHP code isn’t responding, it doesn’t look like that’s down to the code.


#12

Moved to #server-config. smile