How to solve php error 502badgateway

(*-*)浩
Release: 2023-02-26 10:18:01
Original
5001 people have browsed it

Currently, one of the most common problems with lnmp one-click installation packages is 502 Bad Gateway. In most cases, the reason is that some lib packages in the script may not be installed before installing php, resulting in php not being compiled and installed successfully.

How to solve php error 502badgateway

Solution: You can try to install it manually according to the script in the lnmp one-click installation package , to see what caused the error.

In php.ini, the eaccelerator configuration item must be placed before the Zend Optimizer configuration, otherwise it may also cause 502 Bad Gateway (recommended learning: PHP video tutorial )

502 problems occur during installation and use. Generally, it is because the default php-cgi process is 5. 502 may be caused by insufficient phpcgi processes. /usr/local/php/etc/ needs to be modified. Increase the max_children value appropriately in php-fpm.conf.

php execution timeout, modify /usr/local/php/etc/php.ini to change max_execution_time to 300

Insufficient disk space, such as mysql log taking up a lot of space

Check whether the php-cgi process is running

The meaning of Nginx 502 Bad Gateway is that the requested PHP-CGI has been executed, but for some reason (usually a problem with reading resources) it has not The PHP-CGI process terminates after execution. Generally speaking, Nginx 502 Bad Gateway is related to the settings of php-fpm.conf.

php-fpm.conf has two crucial parameters, one is max_children and the other is request_terminate_timeout, but this value is not universal and needs to be calculated by yourself.

When a 502 problem occurs during installation and use, it is usually because the default php-cgi process is 5. It may be that the phpcgi process is not enough, causing 502. /usr/local/php/etc/php needs to be modified. -fpm.conf Increase the max_children value appropriately.

The above is the detailed content of How to solve php error 502badgateway. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!