简体   繁体   中英

Laravel PHP5.6 Class not found until opcache enabled

Hi I have a Debian Wheezy VM which i recently upgraded to PHP 5.6 which came with OpCache from 5.4 with OpCache installed separately. Since I have done this all my scripts (Im using Laravel btw) have become cached which I don't want, so I decided to disable opcache.

/etc/php5/mods-available/opcache.ini:

opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=2
opcache.fast_shutdown=1
opcache.enable_cli=0
opcache.enable=0

However if I disable from the apache php.ini file I get the following error:

ReflectionException thrown with message "Class SettingRepository does not exist"

However if I enable it and just reset the opcache any time I need to see new changes they are rendered correctly, and I can see in my composer autoload class map that they are loaded ie

'SettingRepository' => $baseDir . '/app/repositories/SettingRepository.php',

Any ideas what I'm doing wrong? I have a feeling its a configuration in apache that is incorrect but I'm not too sure, any suggestions?

Keep it enabled and set opcache.revalidate_freq=0 and restart apache

Or

Put the following somewhere in your laravel application to disable caching for laravel only and only in your debug environment:

if (env('APP_DEBUG')) ini_set('opcache.revalidate_freq', '0');

Maybe you need to change APP_DEBUG to your environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM