"PHP" Nginx php-fpm "session lock" problem

Source: Internet
Author: User
Tags fpm
Nginx + PHP-FPM Environment Deployment article:

http://blog.s135.com/nginx_php_v6/

About PHP-FPM's Baidu Encyclopedia introduction:

Http://baike.baidu.com/view/4168033.htm

The author in the actual use of this set of environment, encountered a strange problem, the specific description of the problem is:

When a browser requests a PHP page from a Web site, the post-start page needs to wait for the previous page to get response before it can start executing.

The problem is found, because the site of a page of the background interface problem, and did not set a time-out mechanism, causing the page to respond to turtle speed. While waiting for this page, and then open the other Site page is not open, to wait until this page returns, will be executed other pages.

After investigation, the problem is locked in the session, because the site uses its own MVC framework, the framework of the action before the execution, the default will be Session_Start (). Because the previous site is deployed on Apache, there will be no problem, but also buried the hidden trouble. When the company's webserver environment is migrated to Nginx, the problem should begin.

The specific reason is unclear, but it can be determined that the combination of the session and NGINX+PHP-FPM environment (has been determined by the experiment).

The solution is to modify the framework, close the default open session, in the need to session of the action class's constructor to open the session, although when such a page has concurrency, there will still be "session lock", I do not think of the professional name, Some people know the cause of the problem, welcome to the "question, but this kind of page in our site only a small part."

It's an interim solution.

The NGINX+PHP-FPM environmental performance described in the Zhang Yi article is very good, but as a relatively new solution, there may be some minor problems compared to the traditional approach of Apache + php-cgi.

I hope this article can give you some help.

  • 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.