Home > Article > Backend Development > PHP development 502 error
1. First, check whether php is running normally. Execute the command
php -v
as shown below. It will prompt that the command is not found, indicating that php is not running.
#2. Start php. The following directory is not a general directory. I use Alibaba Cloud Server. My php directory is in the following directory. If you installed php using other methods, you can look for the php directory.
The startup file is under the php root directory /sbin/php-fpm/alidata/server/php-5.4.23/sbin/php-fpm
3, As shown in the picture 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 further investigated: the previous operation and maintenance ran away without configuring the environment. So the project cannot run. My solution here is to directly change the name of the directory /php-5.4.23/ to /php/
4. To summarize, if you access static files, there is no problem, 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 through the command php -v
to check whether php has started normally. If it is indeed the 502 error caused by PHP not starting, then find your PHP root directory and find the corresponding configuration file /alidata/server/php-5.4.23/sbin/php-fpm
and then go Start it and solve other problems accordingly.
Recommended tutorial: PHP video tutorial
The above is the detailed content of PHP development 502 error. For more information, please follow other related articles on the PHP Chinese website!