A
A
Alexander2015-08-22 15:07:20
PHP
Alexander, 2015-08-22 15:07:20

Why does the request come with an empty $_POST?

Can't get data from POST request, empty array comes.

  1. If I send a GET request, the data gets into $_GET and $_REQUEST
  2. For POST request:
    • $_REQUEST empty
    • $_POST empty
    • file_get_contents('php://input') empty
    • file_get_contents('php://stdin') hangs and falls off after a minute due to timeout


Here are the test scripts:
https://my.hosting.digitalmakers.ru/mancgi/resultt... - here is the form
https://my.hosting.digitalmakers.ru/mancgi/resultt... - here comes the request
Script code with form:
echo "Content-Type: text/html\n\n";

echo "<form method='POST' action='/mancgi/resulttest.php'>";
echo "<input type='hidden' name='WMI_DATA' value='Success'/>";
echo "<input type='submit' value='GO!'/>";
echo "</form>";

Script code that catches the request:
echo "Content-Type: text/html\n\n";

$data = file_get_contents('php://input');
print "DATA: <pre>";
var_dump($data);
var_dump($_POST);
print "</pre>";

Because I think this is an Nginx problem, so here is its config:
# domain for ISPmanager and BILLmanager
server {	
       listen 82.146.54.197:443;
       server_name my.hosting.digitalmakers.ru;	
       ssl on;	
       ssl_certificate /usr/local/mgr5/etc/manager.crt;	
       ssl_certificate_key /usr/local/mgr5/etc/manager.key; 	
 
       set $mgr_proxy "http://82.146.54.197:1500";         
         
       location ^~ /manimg/ { 		
              alias /usr/local/mgr5/skins/; 	
       } 	
       
       location / { 		
                proxy_pass $mgr_proxy; 		
                proxy_redirect $mgr_proxy /; 		
                proxy_set_header Host $host:$server_port; 		
                proxy_set_header X-Forwarded-For $remote_addr; 		
                proxy_set_header X-Forwarded-Proto $scheme; 		
                proxy_set_header X-Real-IP $remote_addr;                
                proxy_set_header X-Forwarded-Secret 062IfeqaXeQERTT;  		
                chunked_transfer_encoding off; 
 	}

 	location ^~ /mancgi/ {
          proxy_pass $mgr_proxy;
          proxy_redirect $mgr_proxy /;
          proxy_set_header Host $host:$server_port;
          proxy_set_header X-Forwarded-For $remote_addr; 
             proxy_set_header X-Forwarded-Proto $scheme;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-Secret 062IfeqaXeQERTT;
          chunked_transfer_encoding off;
          
          include fastcgi_params;
          fastcgi_param QUERY_STRING $query_string;
          fastcgi_param REQUEST_METHOD $request_method;
          fastcgi_param CONTENT_TYPE $content_type;
          fastcgi_param CONTENT_LENGTH $content_length;
  }
}

php.ini went through everything for possible problems:
  • post_max_size 10M
  • enable_post_data_reading On
  • request_orderGP
  • variables_order GPCS

Tell me what could be the problem? The third day I dig with her.
PS GET data also fails to catch. $_GET and $_REQUEST are empty

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arman, 2015-08-22
@Arik

And if you copy "location /" to the end, what is in /mancgi/?

include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

V
Vlad Zhivotnev, 2015-08-24
@inkvizitor68sl

Your nginx config says "proxy everything in ispmanager" (well, or "only ispmanager should be opened on this input").
Create a site in the panel, then try to do something.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question