Home  >  Article  >  Backend Development  >  PHP+Nginx string content POST submits 502 error?

PHP+Nginx string content POST submits 502 error?

WBOY
WBOYOriginal
2016-12-01 00:56:501752browse

I made an input name as title, a button, and wrote an echo $_POST['title'] at the top

Input When inputting 5 characters of "Newborn Series", clicking the button will be unresponsive for a long time and then a 502 error will occur. This problem will not occur with any other characters, such as (Newborn Series__/Series Newborn/Newborn Series) ,

But it doesn’t work in some cases
For example, Newborn series./Newborn series! This kind of string

How should I solve it? There is no database saving involved.

I’m so confused, I don’t know how to investigate.

Reply content:

I made an input name as title, a button, and wrote an echo $_POST['title'] at the top

Input When inputting 5 characters of "Newborn Series", clicking the button will be unresponsive for a long time and then a 502 error will occur. This problem will not occur with any other characters, such as (Newborn Series__/Series Newborn/Newborn Series) ,

But it doesn’t work in some cases
For example, Newborn series./Newborn series! This kind of string

How should I solve it? There is no database saving involved.

I’m so confused, I don’t know how to investigate.

First of all, regardless of the html input, make sure your php can be executed correctly and write a separate php file

<code><?php
phpinfo()</code>

Save this file as phpinfo.php, then run it to see if you can see the information output;

The problem you encountered is not a question of whether your code is correct; it feels like the problem lies in your PHP operating environment

Sir, you can print out the POST value first in the receiving program. If it can be output correctly, it means that the page has also received the data. As for why a 502 gateway error is reported, you have to check it step by step.

502 Is nginx configuration wrong?

Recommend you to check it out! nginx php-fpm configuration! Also check the configuration of php-fpm! Both configurations, parameters such as timeout and cache are consistent!

When you access php under nginx, you need to ask nginx to forward it to php-fpm! php-fpm is forwarding to php! There are surprises in this process. It’s a gateway error!

502: fastcgi server did not return the correct response to the web server

  • Check to see if php-fpm is not up, or there is a problem with the configuration, whether it is the listening port 9000 or the unix domain socket

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn