什么是PHP中的操作码和数据缓存

时间:2014-09-27 09:26:03

标签: php symfony doctrine-orm apc akeneo

我正在安装Akeneo PIM。它基于Symfony2框架。

它有一些先决条件。有些我理解,有些令人困惑。

我在WAMP中安装了Zend opcache,并在phpinfo中显示,但我不知道php中有什么数据缓存。

我需要帮助......

我收到此错误:

( ! ) Fatal error: Call to undefined function Doctrine\Common\Cache\apc_fetch() in D:\wamp\www\akeneo\vendor\doctrine\cache\lib\Doctrine\Common\Cache\ApcCache.php on line 40
Call Stack
#   Time    Memory  Function    Location
1   0.0140  139760  {main}( )   ..\app.php:0
2   0.4300  334232  Symfony\Component\HttpKernel\Kernel->handle( )  ..\app.php:24
3   0.4300  334344  Symfony\Component\HttpKernel\Kernel->boot( )    ..\bootstrap.php.cache:2253
4   84.9849 830408  Symfony\Component\HttpKernel\Kernel->initializeContainer( ) ..\bootstrap.php.cache:2222
5   157.3350    19333112    Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp( )    ..\bootstrap.php.cache:2451
6   157.4190    19379904    Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer->warmUp( ) ..\CacheWarmerAggregate.php:47
7   157.4330    19380208    Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata( ) ..\ProxyCacheWarmer.php:69
8   159.3501    20279512    Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor( ) ..\AbstractClassMetadataFactory.php:114
9   159.3561    20283608    Pim\Bundle\CatalogBundle\Doctrine\ArrayApcCache->fetch( )   ..\AbstractClassMetadataFactory.php:207
10  159.3561    20283632    Doctrine\Common\Cache\CacheProvider->fetch( )   ..\ArrayApcCache.php:54
11  159.3561    20283656    Doctrine\Common\Cache\CacheProvider->getNamespacedId( ) ..\CacheProvider.php:78
12  159.3561    20283688    Doctrine\Common\Cache\CacheProvider->getNamespaceVersion( ) ..\CacheProvider.php:147
13  159.3561    20284072    Doctrine\Common\Cache\ApcCache->doFetch( )  ..\CacheProvider.php:174

2 个答案:

答案 0 :(得分:1)

你应该在你的“wamp”上安装APC,一个php扩展。我认为Installing php_apc.dll on wampserver可以帮助您在Windows的wamp上安装APC

答案 1 :(得分:1)

Akeneo需要两种类型的缓存:一种用于加速代码执行,另一种用于数据缓存。

如果您使用PHP> = 5.5,请考虑使用ZendOPcache和apcu。请注意,ZendOPcache大部分时间都是使用PHP安装的,但有时您需要自己启用它。

如果您使用PHP< 5.5,考虑使用apc和apcu。

要确保启用两个缓存,您可以使用一个带有phpinfo();调用的简单PHP脚本。提示:不要在shell中使用php -i来验证这一点,有时在CLI模式下禁用PHP加速器...对于Zend OPcache,您还可以使用Rasmus提出的网页,例如:https://github.com/rlerdorf/opcache-status

最后但同样重要的是,我不建议使用Zend OPcache进行开发。首先,您在开发时可能不需要更多性能,其次,您可能会浪费时间来确定代码错误是否是由于缓存造成的(例如,如果您的Zend OPcache配置是非常激进,并不验证PHP文件中的代码更改...)。

相关问题