I am on a dedicated server - running multiple portals in respective virtual directories. Some of the previously loaded websites are using Zend opcode cache. While my new commerce portal uses an APC based cache and I have migrated this website to the new server.

I am having frequent internal server 500 errors and crashes.

I am having following config:

  • PHP 5.4.27 and APC 3.1.13,
  • Centos server with about 4 GB ram,
  • APC is using php-fpm

Zend opcode cache config:

Opcode Caching  Up and Running
Optimization    Enabled
Startup OK
Shared memory model mmap
Cache hits  71322
Cache misses    1049
Used memory 13544916
Free memory 42838688
Wasted memory   10725260
Cached scripts  298
Cached keys 309
Max keys    3907

APC config: shm_size = 2024M ..and so on...

Could this be a possible reason for crashes? Do i need to disable one of them or can they run together. I am afraid disabling zend should not cause issues to other websties - so just wanted to be sure?


It is a very probable cause of crashing. If your software do not use apc key cache, but only opcache, then upgrade to Zend OPcache should just work. If you use apc key cache, then there will be some programming involved to migrate to some other key caching solution like memcached. From php 5.4 and up most benchmarks show a reasonable speed up using Zend OPcache vs APC.

| improve this answer | |

I can imagine what would happen if you tried to run two opcode caches simultaneously. It looks a lot like this.

502 Bad Gateway

So you should run one opcode cache, and one only.

And, this may surprise you, but you need to get rid of APC, and keep Zend OPcache. The reason is that APC is very, very crashy. It alone may well be the cause of your PHP crashes, as it was for me and many others.

Unless your new commerce portal is truly bizarre, it should work fine with Zend OPcache.

| improve this answer | |
  • Dear Michael and Kazimieras ! , I can't thank more for such a bang on insight, and that exactly was the cause. Two Opcaches running together were causing Havoc and I was busy all the time digging into APC and my codes only for about a month, then fanning out to the other factors and thought checking on this. It works great now. – Satyadeo Kumar Jul 10 '14 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.