2013-01-25 38 views
1

由于APC中存在一个Bug,我不得不使用另一个Cache-Drive。我删除了APC并安装了xcache。 config.php说你的配置看起来不错,可以运行SymfonySymfony2:将APC更改为xcache

我上要求以下错误:

PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to use ApcClassLoader as APC is not enabled.' in /var/.../app/bootstrap.php.cache:1039 
Stack trace: 
#0 /var/.../web/app.php(11): Symfony\\Component\\ClassLoader\\ApcClassLoader->__construct('sf2', Object(Composer\\Autoload\\ClassLoader)) 
#1 {main} 
thrown in /var/...app/bootstrap.php.cache on line 1039 

我如何告诉Symfony的,而不是使用APC了XCache?

+0

问题修正:改变网页/ app.php使用在APC XCache将 – icksde

+0

什么错误? – ChocoDeveloper

+0

安装APC时,其他PHP项目会引发分段错误 – icksde

回答

3

有同样的问题,这是我做的:

在第12行替换

$loader = new ApcClassLoader('sf2', $loader); 

$loader = new XcacheClassLoader('sf2', $loader); 

(并确定正确使用语句)

0

替换后$loader = new ApcClassLoader('tcs_beta_prod', $loader);$loader = new XcacheClassLoader('tcs_beta_prod', $loader);并添加use Symfony\Component\ClassLoader\XcacheClassLoader;我有这个bug Fatal error: Class 'Symfony\Component\ClassLoader\XcacheClassLoader' not found in C:\xampp\htdocs\edt\web\app.php on line 11。 这里是我的app.php

<?php 

use Symfony\Component\ClassLoader\XcacheClassLoader; 
use Symfony\Component\HttpFoundation\Request; 

$loader = require_once __DIR__.'/../app/bootstrap.php.cache'; 

// Use APC for autoloading to improve performance 
// Change 'sf2' by the prefix you want in order to prevent key conflict with another application 

$loader = new XcacheClassLoader('tcs_beta_prod', $loader); 
$loader->register(true); 


require_once __DIR__.'/../app/AppKernel.php'; 
require_once __DIR__.'/../app/AppCache.php'; 

$kernel = new AppKernel('prod', false); 
$kernel->loadClassCache(); 
$kernel = new AppCache($kernel); 
$request = Request::createFromGlobals(); 
Request::setTrustedProxies(array($request->server->get('REMOTE_ADDR'))); // per suggestion from Farid/Patrick to deal with ELB proxying 
$response = $kernel->handle($request); 
$response->send(); 
$kernel->terminate($request, $response); 
0

你没有定义了XCache使用声明:

use Symfony\Component\ClassLoader\XcacheClassLoader; 
use Symfony\Component\HttpFoundation\Request; 
use Symfony\Component\ClassLoader\XcacheClassLoader;