The first thing to make sure is that the static files of the website such as html, txt, etc. can be accessed normally. It means there is no problem with nginx
Then a 502 error occurs when accessing the php file. It is not a response problem, but a 502 error occurs directly. Then this experience may help you
The probability of this kind of problem is relatively low. What I wrote is just to provide beginners with a solution to the problem. The reason is simple, because php is not started.
This example assumes that the cloud server can be accessed. If this problem occurs in the purchased space, you can contact the space service provider
First, determine whether php is running normally and execute the command (recommended learning: PHP video tutorial )
php -v
As shown below, the prompt command is not found, indicating that php is not running.
Start PHP. The directory below is not a general directory. I am using Alibaba Cloud Server. My PHP directory is in the directory below. If you installed php using other methods, you can look for the php directory.
To be honest, the startup file is /sbin/php-fpm under the php root directory
/alidata/server/php-5.4.23/sbin/php-fpm
As shown below, The reason why my 502 appears is because php has not been started, and the reason why it cannot be started is because the configuration file cannot be found.
The reason is that the previous operation and maintenance ran away without configuring the environment. So the project cannot run.
My solution here is to change the name of the directory /php-5.4.23/ directly to /php/ and it will be all done
To summarize, if you have no problem accessing static files, but all PHP file access directly prompts a 502 error, then you can consider whether it is because the PHP function or the process has not started.
Check the php version by command php -v to check whether php starts normally.
If it is indeed a 502 error caused by php not being started.
Then find your php root directory and find the corresponding configuration file
/alidata/server/php-5.4.23/sbin/php-fpm
Then start it, and solve the corresponding problems if you encounter other problems
The above is the detailed content of 502 error when running php file - non-timeout issue. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6
Visual web development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1
Easy-to-use and free code editor
