Upgrade PHP from 5.3.28 to 5.3.29 O'Clock Nginx appears 502 error _php tutorial

Source: Internet
Author: User

Upgrade PHP from 5.3.28 to 5.3.29 O'Clock Nginx 502 Error occurred


This article focuses on upgrading PHP from 5.3.28 to 5.3.29 O'Clock Nginx appears 502 errors, the need for friends can refer to the following

Today, the PHP upgrade from 5.3.28 to 5.3.29, found that the site cannot open, prompted "502 Bad Gateway", access to static resources can, but access to any PHP file will be 502.

Actually found this problem before, but have not found a solution, so I always keep PHP at 5.3.28 version.

According to my previous temper, I have to have all the latest stable version of software, but PHP and other software is the exception, because the version is high, will cause many programs are incompatible, relatively speaking 5.3 compatibility is one of the best version, of course 5.2 can also.

Obsessive Compulsive disorder, official said 5.3.29 is the last version of 5.3, the last version of this problem has been unresolved and I am very uncomfortable.

Search the Internet, no one appeared to me this problem, all the compilation process, configuration process, is usual, before from 5.3.251 until 5.3.28 are all used I wrote the same upgrade script, according to the same sub-version of the series, the same compilation and configuration process, should not have problems.

Why 5.3.251 until 5.3.28 is all right, 5.3.29 is no problem?

Today finally found the root of the problem, I was drunk ...

Since I don't want to occupy extra ports, the UNIX sockets that have been used between Nginx and PHP-FPM are said to be much more efficient.

PHP upgrade to 5.3. After 29, there are 502 errors, and is an open Web page error, not as a result of PHP execution timeout caused by the NGINX hint 502, more like the php-fpm abnormal termination, or ngxin is not connected to fastcgi at all.

Using PHP-FPM log is also depressed, I opened the log, but also set the log path, but there is no log generated.

Well, according to the previous ideas to find out the reasons for the problem:

1.PHP-FPM at the beginning of the work was abnormally terminated;

2.Ngxin is not connected to the fastcgi at all.

The first may be directly ruled out, because there are 502 errors, the background of the PHP-FPM process did not exit, but also survived well.

So probably the second possibility, I changed the Nginx and php-fpm configuration file, changed to the traditional "Address: port" form

In the PHP-FPM configuration file:

Listen = 127.0.0.1:1234

Nginx configuration file:

Fastcgi_pass 127.0.0.1:1234

Restart the service, the website has been opened smoothly.

It seems that Nginx is not connected to the PHP-FPM, then the problem is where? did 5.3.29 get rid of the UNIX socket connection? I don't think it's possible to check the changelog or see the items.

I changed the Nginx and PHP-FPM configuration files back.

In the PHP-FPM configuration file:

Listen =/tmp/php-cgi.sock

Nginx configuration file:

Fastcgi_pass Unix:/tmp/php-cgi.sock;

Restart the service, immediately 502.

First think of the check permissions, anyway, is the test, so I apart directly to the PHP-FPM sock file permissions to change to 777.

chmod 777/tmp/php-cgi.sock

Open the page directly, can open!

Okay, that's the permissions problem, restart the service, check the Php-cgi.sock permissions.

-RWX------. 1 root root 663 September 00:16 Php-cgi.sock

This... The reason is already very clear, no wonder Nginx can't even php-fpm,php-cgi.sock the authority is 700,

But the question comes, why the same compilation and configuration process, 5.3.28 before the version is no problem? I'm looking for another server that doesn't have an upgrade 5.3.29:

Srw-rw-rw-1 root root 0 September 21:11 php-cgi.sock

Found its permission is 666, this ... I can't understand it ... Why is the default permission configuration of 5.3.28 666, and the 5.3.29 becomes 700?

Check out the PHP documentation to find a workaround

Add the configuration file in PHP-FPM, the first two are the owner and user group of the specified Php-cgi.sock, and the latter is the specified file permissions.

Listen.owner = www

Listen.group = www

Listen.mode = 0666

Restart the service and solve the problem.

http://www.bkjia.com/PHPjc/997705.html www.bkjia.com true http://www.bkjia.com/PHPjc/997705.html techarticle upgrade PHP from 5.3.28 to 5.3.29 O'Clock Nginx 502 Error This article mainly describes the upgrading of PHP from 5.3.28 to 5.3.29 O'Clock Nginx appeared 502 error, the need for friends can refer to the following today will PHP from ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.