Reputation: 121
I installed and enabled APCu in my xampp server like:
downloaded file php_apcu.dll from (PHP 7: http://pecl.php.net/package/APCu/5.1.3/windows) and copy/paste it in the extension directory. also I enabled it from php.ini:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
[...]
extension=php_apcu.dll
so restart both apache server and symfony server.
phpinfo() show me that apc enabled correctly:
but symfony not recognized it:
Upvotes: 1
Views: 1982
Reputation: 14470
I think your have successfully setup APC
but symfony seems to somehow cache the results itself. Try following to see the updated status
depending on os restart apache (e.g on ubuntu/debian)
sudo service apache2 restart
cd to symfony project directory and clear cache
bin/console cache:clear
And reload the page, you should see the APC will be now green(hopefully)
The actual component class that is responsible to collect these states is
Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector
and as I browse through its not doing anything special when rendering those red/green boxes in browser, just checking if extension is loaded and its enabled e.g the collect function does look like:
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data = array(
'app_name' => $this->name,
'app_version' => $this->version,
'token' => $response->headers->get('X-Debug-Token'),
'symfony_version' => Kernel::VERSION,
'symfony_state' => 'unknown',
'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a',
'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
'php_version' => PHP_VERSION,
'xdebug_enabled' => extension_loaded('xdebug'),
'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'),
'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'),
'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'),
'wincache_enabled' => extension_loaded('wincache') && ini_get('wincache.ocenabled'),
'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
'bundles' => array(),
'sapi_name' => PHP_SAPI,
);
if (isset($this->kernel)) {
foreach ($this->kernel->getBundles() as $name => $bundle) {
$this->data['bundles'][$name] = $bundle->getPath();
}
$this->data['symfony_state'] = $this->determineSymfonyState();
}
}
The line in question is
'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'),
I had same issue and my box is green after cache:clear. But there is more to it if you want to use apc caching e.g you have to enabled specifically for some component like doctrine and validations
Upvotes: 2