Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Symfony2:将APC更改为xcache_Php_Symfony_Symfony 2.1_Apc_Xcache - Fatal编程技术网

Php Symfony2:将APC更改为xcache

Php Symfony2:将APC更改为xcache,php,symfony,symfony-2.1,apc,xcache,Php,Symfony,Symfony 2.1,Apc,Xcache,因为APC中有一个Bug,我不得不使用另一个缓存驱动器。我删除了APC并安装了xcache。php说您的配置看起来很适合运行Symfony 我在请求时收到以下错误: PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to use ApcClassLoader as APC is not enabled.' in /var/.../app/bootstrap.php.cache:1039 Sta

因为APC中有一个Bug,我不得不使用另一个缓存驱动器。我删除了APC并安装了xcache。php说您的配置看起来很适合运行Symfony

我在请求时收到以下错误:

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使用xcache而不是APC?

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

第12行中的替换

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


(并定义正确的使用语句)

替换后
$loader=new ApcClassLoader('tcs\u beta\u prod',$loader)
$loader=新的XcacheClassLoader('tcs_beta_prod',$loader)
和add
使用Symfony\Component\ClassLoader\XcacheClassLoader我有一个错误
致命错误:在第11行的C:\xampp\htdocs\edt\web\app.php中找不到类“Symfony\Component\ClassLoader\XcacheClassLoader”。
这是我的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);

您没有为XCache定义use语句:

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

问题已修复:将web/app.php更改为使用xcache其他php项目在安装APC时引发分段错误您是如何将web/app.php更改为使用xcache的?你是说./autoload.php吗?一旦澄清了这一点,文件中的变化究竟是什么?使用“Symfony\Component\ClassLoader\XCacheClassLoader”而不是使用Symfony\Component\ClassLoader\UniversalClassLoader足够了吗?
use Symfony\Component\ClassLoader\XcacheClassLoader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\ClassLoader\XcacheClassLoader;