Monday 21 January 2013

Nginx error: 502 Bad Gateway. ZF2, APC and segmentation fault.

I tried Zend Framework 2 for my last project. When everything was done with development I moved project to production server but every time I tried to open project url in bowser Nginx returned an error:

502 bad gateway

Server is running under Debian, also I have installed Nginx(1.2.6) + PHP(5.3.20) and PHP-FPM.

Increasing buffer size and read timeout value in Nginx config had no results, still 502 error. I've looked into Nginx logs and found next entries:

… recv() failed (104: Connection reset by peer) while reading response header from upstream ...

So, it seems that problem is not in Nginx config. Something is wrong with backend. PHP-FPM log contains plenty of entries like next:

php5-fpm.log:
WARNING: [pool www] child 7050 exited on signal 11 (SIGSEGV) after 14.101753 seconds from start

Well, something is causing segmentation fault. I'm hosting a lot of projects on this server and everything was fine, problem appeared only for the last project that was developed using ZF2.

Googling a little bit, I found that some of PHP extensions can cause segmentation fault. One by one I started disabling PHP-extensions. After I disabled APC extension problem disappeared and everything started working fine. So, disabling APC extension helped to solve the problem and seems that ZF2 has some problems with APC, or APC has some problems with ZF2 :)

Will try to make some research what exactly was the reason of this problem and post here if I'll find something interesting.

15 comments:

  1. Nice to hear:) Will add some new information as soon as I get something interesting and helpful. Thanks for you comment!

    ReplyDelete
  2. Cool! This is really informative. I think I can use this as a reference. Thanks for sharing.




    APC UPS BATTERIES

    ReplyDelete
  3. Hi guys, I have the same problem with apc extension. Have you solved the error?, i can't any idea about it. Thanks and greetings

    ReplyDelete
    Replies
    1. Hi Kamal. I didn't manage to find out what could cause the problem. I faced this problem working with Zend Framework v2.0.7. Now working with ZF2.2 I can't reproduce it.

      Delete
  4. Thanks for the sharing of such information. we will pass it on to our readers. This is a great reading. Thanking you.
    web design company in delhi

    ReplyDelete
  5. This is the pleasant bit of data in light of the fact that I am additionally a PHP Zend Developer and I am working in a product organization. I like your article and bookmarking for new data on it.
    Affordable Web Design

    ReplyDelete
  6. It’s basically an outstanding and efficient product of details. I am grateful that you provide this useful details with us. Please keep us recommended like this. Thanks for working with.

    website development companies Bangalore | website designing Bangalore

    ReplyDelete
  7. Wonderful post! You've made some very astute observations and I am thankful for the the effort you have put into your writing. Its clear that you know what you are talking about. I am looking forward to reading more of your sites content.
    happy wheels | coolmathgames | run 3 | happy wheels online | cool maths 4 kids | game run 3 online

    ReplyDelete
  8. Seperti yang sudah admin sampaikan tadi jika urutan kartu yang harus Anda susunan nanti akan sesuai dengan aturanya
    asikqq
    dewaqq
    sumoqq
    interqq
    pionpoker
    bandar ceme terpercaya
    hobiqq
    paito warna terlengkap
    bocoran sgp

    ReplyDelete
  9. Greetings. I was amazing if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.
    hardware and networking training in chennai

    hardware and networking training in tambaram

    xamarin training in chennai

    xamarin training in tambaram

    ios training in chennai

    ios training in tambaram

    iot training in chennai

    iot training in tambaram

    ReplyDelete
  10. I just loved your article on the beginners guide to starting a blog.If somebody take this blog article seriously in their life, he/she can earn his living by doing blogging.thank you for this article.
    sap training in chennai

    sap training in velachery

    azure training in chennai

    azure training in velachery

    cyber security course in chennai

    cyber security course in velachery

    ethical hacking course in chennai

    ethical hacking course in velachery

    ReplyDelete