3

I've been using APC for Opcode optimization and data storage for few time until I read that OPCache is directly included in PHP since PHP5.5. Thus, I switched to OPCache + APCu.

But small changes in code like adding a 'die(var_dump($some_var));' for debugging aren't taken into account but after some time.

Should I turn OPCache off in development mode ?

ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
Aleks Ben Maza
  • 327
  • 3
  • 12
  • 1
    I would leave it on because OPCache is a piece of the production puzzle so you need to be able to detect OPCache issues in development. Try changing the frequency of validation in your development environment. http://php.net/manual/en/opcache.configuration.php#ini.opcache.revalidate-freq – MonkeyZeus Nov 03 '16 at 15:24

1 Answers1

3

If your using opcache then any changes to your code won't take effect if it's reading from cache. You can control how opcache behaves in your php.ini file (http://php.net/manual/en/opcache.configuration.php).

If it takes a few seconds before your code changes appear and that's an problem for you, you can reduce the opcache.revalidate_freq to 0 so that file changes force it to re-cache instantly. I would advise you keep opcache on in production though as it will greatly increase the speed of your application.

fire
  • 21,383
  • 17
  • 79
  • 114