1

Because a Bug in APC, i had to use another Cache-Drive. I removed APC and installed xcache. config.php says Your configuration looks good to run Symfony.

I got the following error on request:

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

How do I tell Symfony to use xcache instead of APC?

icksde
  • 267
  • 4
  • 11
  • Problem fixed: changed web/app.php to use xcache – icksde Jan 25 '13 at 10:24
  • Other PHP-Projects throw an Segmentation Fault when APC is installed – icksde Jan 30 '13 at 09:20
  • How exactly did you changed web/app.php to use xcache? Wouldn't you mean ./autoload.php? And once that is clarified, what exactly was the change in the file? is it enough with 'use Symfony\Component\ClassLoader\XCacheClassLoader' instead of use Symfony\Component\ClassLoader\UniversalClassLoader? – ElPiter Apr 02 '13 at 11:55

3 Answers3

3

had the same problem, this is how i did it:

In line 12 replace

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

with

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

(and define correct use statement)

Timetrick
  • 186
  • 1
  • 9
0

after replace $loader = new ApcClassLoader('tcs_beta_prod', $loader); to $loader = new XcacheClassLoader('tcs_beta_prod', $loader); and add use Symfony\Component\ClassLoader\XcacheClassLoader; i have this bug Fatal error: Class 'Symfony\Component\ClassLoader\XcacheClassLoader' not found in C:\xampp\htdocs\edt\web\app.php on line 11. Here is my 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

You didn't define the use statement for XCache:

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