2

PHP features a new code caching module called OPCache. Symfony2 recommended to use ApcClassLoader (based on APC) or XcacheClassLoader (based on XCache) to cache the mapping from a class to its containing file. My server (Apache 2.4 with PHP 5.6) use OpCache.

  1. Is there an alternative "cache mapping" for OpCache? I have not found.
  2. I can use APC and OpCache together (I could use ApcClassLoader)? I think not.
Simone Nigro
  • 4,717
  • 2
  • 37
  • 72

1 Answers1

7

The usage of APC makes sense up to PHP version 5.4. But even with 5.4 it is not fully compatible. From PHP 5.5 on, it's better to use APCu.

As of PHP 5.5 the Zend Opcache is a part of the core PHP distribution. You may combine it with APCu.

Calls to the old APC functions will be emulated: apc_*()-> apcu_*(). "APC emulation" will show up in phpinfo(), when the APCu ext is loaded.

enter image description here

So given PHP 5.6 with OpCache and APCu the SF2 ApcClassLoader should work.

The answer for question 1: The OpCache is not a full blown cache, like APC, it's a simple opcode cache with some optimization steps. And it's not a userland cache - "just" an internal cache, speeding the processing of PHP up.

Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
  • should work? ok , I'll try it I'll let you know. Meanwhile upvote for helpful information. – Simone Nigro Jan 22 '15 at 20:33
  • Thanks! Yes, using memcache makes sense. A memory storage is hard to beat performance wise. Additionally, the Opcache might need some tuning for full performance, see here: http://stackoverflow.com/questions/23382615/apc-apcu-opcache-performance-poor – Jens A. Koch Jan 22 '15 at 20:41