Using Symfony 2.0, I am trying to make it work together with XCache.
XCache is properly installed.
As for the offitial Symfony documentation, we have this XcacheClassLoader.php that should make it. As for the same documentation, we get this piece of advice:
/**
* XcacheClassLoader implements a wrapping autoloader cached in Xcache for PHP 5.3.
*
* It expects an object implementing a findFile method to find the file. This
* allows using it as a wrapper around the other loaders of the component (the
* ClassLoader and the UniversalClassLoader for instance) but also around any
* other autoloader following this convention (the Composer one for instance)
*
* $loader = new ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* $cachedLoader = new XcacheClassLoader('my_prefix', $loader);
*
* // activate the cached autoloader
* $cachedLoader->register();
*
* // eventually deactivate the non-cached loader if it was registered previously
* // to be sure to use the cached one.
* $loader->unregister();
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Kris Wallsmith <kris@symfony.com>
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
*
* @api
*/
If I am getting it right, the autoload.php should contain that code. This is what I am doing in autoload.php:
Normal loader is declared:
$loader = new UniversalClassLoader();
All stuff is done to that $loader, like registerNamespaces, registerPrefixes and all external dependencies are loaded to the $loader
:
$loader
->registerNamespaces(
array(
'Symfony' => array(__DIR__ . '/../vendor/symfony/src',
__DIR__ . '/../vendor/bundles'),
'Sensio' => __DIR__ . '/../vendor/bundles',
'JMS' => __DIR__ . '/../vendor/bundles',
'Doctrine\\Common' => __DIR__. '/../vendor/doctrine-common/lib',
'Doctrine\\DBAL' => __DIR__
etc...
Once all the "normal" stuff is made to the $loader, I declare the $cachedLoader, just as said in the documentation:
// register classes with namespaces
$loader->add('Symfony\Component', __DIR__.'/component');
$loader->add('Symfony', __DIR__.'/framework');
$cachedLoader = new XcacheClassLoader('my_prefix', $loader);
// activate the cached autoloader
$cachedLoader->register();
// eventually deactivate the non-cached loader if it was registered previously
// to be sure to use the cached one.
$loader->unregister();
Am I getting it right? Well obviously not, because all what I get is a completely blank page in my browser and not even logs are written in case they could give me some clue.
Thank you in advance.