Symfony2 bootstrap.php.cache 试图包含一个不存在的文件
Symfony2 bootstrap.php.cache tries to include a non-existent file
我们有一个 Symfony 2.6.8 应用程序,我们随机得到这个奇怪的错误日志:
[Thu Jun 11 12:29:14 2015] [error] [client 1.1.1.1] PHP Fatal error: require(): Failed opening required 'aab' (include_path='.:/usr/share/php:/usr/share/pear') in /data/apps/front/1.1.1/app/bootstrap.php.cache on line 2752
bootstrap.php.cache
的第2752行是:
if ($file = $this->findFile($class)) {
require $file; // line 2752
return true;
}
findFile()
方法是:
public function findFile($class)
{
if (false === $file = apc_fetch($this->prefix.$class))
{
apc_store($this->prefix.$class, $file = $this->decorated->findFile($class));
}
}
其他配置信息,我们正在使用:
- Symfony 2.6.8
- PHP 5.4.41
- APC 3.1.13
我不明白请求的 aab
文件是什么。我们使用的是 APC 自动加载器,所以我怀疑 APC 的条目已损坏,因为
重新启动 Apache2 时,应用程序正常运行。当应用程序处于这种状态时我无法调试,因为我们使用 apc.stat = 0
所以 php 文件不会在每次请求时重新加载。修改 bootstrap 无效。
可能是我们的APC设置不适应:
apc.cache_by_default => On => On
apc.canonicalize => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On
apc.file_md5 => Off => Off
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => Off => Off
apc.lazy_classes => Off => Off
apc.lazy_functions => Off => Off
apc.max_file_size => 1M => 1M
apc.mmap_file_mask => no value => no value
apc.num_files_hint => 1000 => 1000
apc.preload_path => no value => no value
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.serializer => default => default
apc.shm_segments => 1 => 1
apc.shm_size => 128M => 128M
apc.shm_strings_buffer => 4M => 4M
apc.slam_defense => On => On
apc.stat => Off => Off
apc.stat_ctime => Off => Off
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 0 => 0
apc.write_lock => On => On
欢迎任何提示!
正如这个问题中所解释的,这是完全相同的问题:"Call to undefined method" after apache reload using apc opcode cache。
该错误来自 Apache2 为日志轮换重新加载。
删除 ApcAutoloder
解决了问题。
我们有一个 Symfony 2.6.8 应用程序,我们随机得到这个奇怪的错误日志:
[Thu Jun 11 12:29:14 2015] [error] [client 1.1.1.1] PHP Fatal error: require(): Failed opening required 'aab' (include_path='.:/usr/share/php:/usr/share/pear') in /data/apps/front/1.1.1/app/bootstrap.php.cache on line 2752
bootstrap.php.cache
的第2752行是:
if ($file = $this->findFile($class)) {
require $file; // line 2752
return true;
}
findFile()
方法是:
public function findFile($class)
{
if (false === $file = apc_fetch($this->prefix.$class))
{
apc_store($this->prefix.$class, $file = $this->decorated->findFile($class));
}
}
其他配置信息,我们正在使用:
- Symfony 2.6.8
- PHP 5.4.41
- APC 3.1.13
我不明白请求的 aab
文件是什么。我们使用的是 APC 自动加载器,所以我怀疑 APC 的条目已损坏,因为
重新启动 Apache2 时,应用程序正常运行。当应用程序处于这种状态时我无法调试,因为我们使用 apc.stat = 0
所以 php 文件不会在每次请求时重新加载。修改 bootstrap 无效。
可能是我们的APC设置不适应:
apc.cache_by_default => On => On
apc.canonicalize => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On
apc.file_md5 => Off => Off
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => Off => Off
apc.lazy_classes => Off => Off
apc.lazy_functions => Off => Off
apc.max_file_size => 1M => 1M
apc.mmap_file_mask => no value => no value
apc.num_files_hint => 1000 => 1000
apc.preload_path => no value => no value
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.serializer => default => default
apc.shm_segments => 1 => 1
apc.shm_size => 128M => 128M
apc.shm_strings_buffer => 4M => 4M
apc.slam_defense => On => On
apc.stat => Off => Off
apc.stat_ctime => Off => Off
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 0 => 0
apc.write_lock => On => On
欢迎任何提示!
正如这个问题中所解释的,这是完全相同的问题:"Call to undefined method" after apache reload using apc opcode cache。
该错误来自 Apache2 为日志轮换重新加载。
删除 ApcAutoloder
解决了问题。