【问题标题】:what is opcode and data cache in php什么是 php 中的操作码和数据缓存
【发布时间】:2014-09-27 09:26:02
【问题描述】:

我正在安装 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

【问题讨论】:

  • 如果您成功地做您想做的事,请告诉我们。如果您认为其中一个答案对您有帮助或将来可以帮助其他人,请考虑投票并标记它。

标签: php symfony doctrine-orm apc akeneo


【解决方案1】:

您应该需要安装APC,这是一个在您的“wamp”上的 php 扩展。我认为Installing php_apc.dll on wampserver 将帮助您在 Windows 的 wamp 上安装 APC

【讨论】:

【解决方案2】:

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

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

如果您使用 PHP

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

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

【讨论】:

    猜你喜欢
    • 2016-07-02
    • 1970-01-01
    • 2011-01-18
    • 1970-01-01
    • 2014-04-19
    • 2011-05-17
    • 2012-08-31
    • 1970-01-01
    • 2020-08-24
    相关资源
    最近更新 更多