Home > Article > Backend Development > PHP+Nginx string content POST submits 502 error?
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.
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