APC 是否与 PHP 5.4 或 PHP 5.5 兼容?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9611676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 07:15:34  来源:igfitidea点击:

Is APC compatible with PHP 5.4 or PHP 5.5?

phpinstallationapc

提问by Greywire

It doesn't seem like APC has been updated to coincide with the php 5.4 release (I wish they would have included APC in PHP core like originally planned).

似乎 APC 没有更新以与 php 5.4 版本一致(我希望他们能像最初计划的那样在 PHP 核心中包含 APC)。

I can't seem to find any definitive answer to whether current APC works with php 5.4+. I managed to find Ubuntu packages for php 5.4, but php-apc packages won't install.

我似乎找不到任何关于当前 APC 是否适用于 php 5.4+ 的明确答案。我设法找到了适用于 php 5.4 的 Ubuntu 软件包,但无法安装 php-apc 软件包。

回答by Leigh

Zend OPCache included in PHP 5.5

PHP 5.5 中包含 Zend OPCache

On the 21st March 2013, the PHP 5.5 beta 1 was released including "Zend OPCache"- It looks firmly like this will be the replacement for APC going forward as it is included in the PHP core, and will have to bemaintained for each new release.

2013 年 3 月 21 日,包含“Zend OPCache”PHP 5.5 beta 1 发布- 看起来这将是 APC 的替代品,因为它包含在 PHP 核心中,并且必须为每个新版本进行维护释放。

I would personally advise those who depend on APC for it's opcode caching to test their code with the upcoming built-in opcode cache, and feed back any issues encountered to ensure a stable final release.

我个人建议那些依赖 APC 的操作码缓存的人使用即将推出的内置操作码缓存测试他们的代码,并反馈遇到的任何问题以确保稳定的最终版本。

I do not know what this means for the future of APC.

我不知道这对 APC 的未来意味着什么。

APC FOR PHP 5.4+ IS STILL FLAGGED AS BETA

适用于 PHP 5.4+ 的 APC 仍标记为测试版

This means the developers do notconsider it completely stable. While many people are experiencing no problems at all with the current SVN releases, there is still the odd report of edge cases from people under certain configurations, or under heavy load.

这意味着开发人员并不认为它完全稳定。虽然许多人在当前的 SVN 版本中完全没有遇到任何问题,但仍然有一些人在某些配置下或在重负载下出现边缘情况的奇怪报告。

As with everything you would want to use in a production environment, make sure you thoroughly test any release (beta orstable) in development or pre-production environments first. This includes load testing!

正如你想在生产环境中使用的一切,务必彻底测试任何版本(测试版开发中稳定)或预生产环境第一。这包括负载测试!

As of the 3.1.13 release, commits to the SVN repository have slowed down somewhat and the bug listdoesn't have that many recent additions. Make of that what you will.

从 3.1.13 版本开始,提交到 SVN 存储库的速度有所放缓,并且错误列表中没有那么多最近添加的内容。做你想做的。

On 10 December 2012 21:05, Rasmus Lerdorf wrote:

APC is at the point now for 5.4 where I don't think there are any more edge cases than we have in 5.3. Neither is perfect, but it is close enough for the majority of sites.

2012 年 12 月 10 日 21:05,Rasmus Lerdorf 写道:

APC 现在是 5.4,我认为没有比 5.3 中更多的边缘情况了。两者都不是完美的,但对于大多数站点来说已经足够接近了。

Anyone with C / gdb skills and some free time is urged to gloss over the bug listand see if they can fix anything, or improve this free open source productthat we all rely on.

任何有 C/gdb 技能和一些空闲时间的人都被敦促掩盖错误列表,看看他们是否可以修复任何东西,或者改进我们都依赖的这个免费的开源产品

Alternative solutions exist, Wikipedia provides a list of PHP accelerators.

存在替代解决方案,维基百科提供了一个PHP 加速器列表

On the 13th of February 2013, Zeev Suraski announcedthe availability of the Zend Optimizer+ source code.

2013 年 2 月 13 日,Zeev Suraski 宣布Zend Optimizer+ 源代码可用。

There has been quite a lengthy discussion about integrating Zend Optimizer+ into the PHP corein the next major version (the version after 5.5). People may wish to familiarise themselves with Zend Optimizer+ in advance, should this be the case.

关于在下一个主要版本(5.5 之后的版本)中将Zend Optimizer+ 集成到 PHP 核心中,已经有相当长的讨论。如果是这种情况,人们可能希望提前熟悉 Zend Optimizer+。



Do not use APC 3.1.14

不要使用 APC 3.1.14

APC 3.1.14 has been removed from PECLdownloads due to some serious memory issues that have been discovered but have not yet been tracked down.

APC 3.1.14 已从 PECL下载中删除,因为一些严重的内存问题已被发现但尚未被追踪。

If you're already using 3.1.14, you may wish to downgrade until 3.1.15 is released. Remember, this is still beta. If you are using it at all, you are using it at your own risk.

如果您已经在使用 3.1.14,您可能希望降级直到 3.1.15 发布。请记住,这仍然是beta。如果您正在使用它,则使用它的风险由您自己承担。

2013-01-02:
APC 3.1.14is available, adding PHP 5.5 compatibility, in addition to resolving a fair number of other bugs.

2013-01-02
APC 3.1.14可用增加了 PHP 5.5 兼容性,此外还解决了相当多的其他错误

Still beta

仍然是测试版



2012-09-03:
APC 3.1.13is available, fixing a number of segfaults.

2012-09-03
APC 3.1.13可用,修复了一些段错误



2012-08-16:
An APC 3.1.12 taghas been created, but is still marked as beta, its available on the APC PECL page, as well as the changelog.

Lots of bin_dump related bugs fixed this time around.

2012-08-16
一个APC 3.1.12标签已经被创建,但仍被标记为测试版,其可用APC PECL页,还有的changelog

这次修复了许多与 bin_dump 相关的错误。



2012-07-19:
An APC 3.1.11 taghas been created, but is still marked as beta, its available on the APC PECL page, as well as the changelog. I've been following the relevant mailing lists, and they are still actively working on fixing APC bugs however it is a complex module and not many people seem to be up to the task. This release fixes the nasty stat=0 bugs when including files.

2012-07-19
一个APC 3.1.11标签已经被创建,但仍被标记为测试版,其可用APC PECL页,还有的changelog。我一直在关注相关的邮件列表,他们仍在积极致力于修复 APC 错误,但它是一个复杂的模块,似乎没有多少人能够胜任这项任务。此版本修复了包含文件时令人讨厌的 stat=0 错误。



2012-04-11:
An APC 3.1.10 tagwas created today, and a beta release of 3.1.10 was placed on the APC PECL page

The changelogstates:

2012-04-11
一个APC 3.1.10标签今天创建和3.1.10 beta版被放置在上APC PECL页

更新日志状态:

  • Add PHP 5.4 support (Dmitry, Anatoliy, Pierre)
  • Fixed bug #22679: Fix apc_bin_dump for constants. Use IS_CONSTANT_TYPE_MASK to handle all the constants, including the unqalified ones (instead of ~IS_CONSTANT_INDEX check)
  • Fixed bug #23822, php crashes on apache restart
  • 添加 PHP 5.4 支持(Dmitry、Anatoliy、Pierre)
  • 修复错误 #22679:修复常量的 apc_bin_dump。使用 IS_CONSTANT_TYPE_MASK 处理所有常量,包括未限定的常量(而不是 ~IS_CONSTANT_INDEX 检查)
  • 修复了错误 #23822,php 在 apache 重启时崩溃

回答by Eric Caron

As of PHP 5.4.7 and APC 3.1.13 (and even APC SVN trunk as of 2012-09-19), although it is "compatible" it is not stable on servers with heavy load, particularly if you're using PHP-FPM and $GLOBALS. Some of the developer discussions on APC talk about unresolved fringe cases.

从 PHP 5.4.7 和 APC 3.1.13(甚至 2012-09-19 的 APC SVN 主干)开始,尽管它是“兼容的”,但它在负载较重的服务器上不稳定,特别是如果您使用 PHP- FPM 和 $GLOBALS。APC 上的一些开发人员讨论讨论了未解决的边缘案例

I'm answering this question 6 months after it was asked because the problem is still prevalent, and encountering this thread w/o an answer like mine is what made me make the leap to PHP 5.4 w/ APC and get burnt. Hopefully this will help people avoid some pain.

我在被问到这个问题 6 个月后才回答这个问题,因为这个问题仍然普遍存在,并且遇到这个线程而没有像我这样的答案是让我飞跃到带有 APC 的 PHP 5.4 并被烧毁的原因。希望这能帮助人们避免一些痛苦。

回答by Simon

It appears that the bug "may" have been fixed in the latest revision to the trunk. I've got it working now with PHP 5.4.0.

似乎该错误“可能”已在主干的最新修订版中得到修复。我现在可以在 PHP 5.4.0 上使用它了。

svn co http://svn.php.net/repository/pecl/apc/trunk/apc-trunk

SVN共同http://svn.php.net/repository/pecl/apc/trunk/APC-干线

cd apc-trunk

cd apc-trunk

phpize

phpize

./configure

。/配置

make

制作

make install

进行安装

回答by Michiel Thalen

Well I'm trying for the last few days, and there is no way I can get an opcode cacher to work with php 5.4. Xcache won't compile, and apc will not recognize certain classes when cached. I think this is the error Simon is talking about.

好吧,我最近几天一直在努力,但我无法让操作码缓存器与 php 5.4 一起使用。Xcache 不会编译,并且 apc 在缓存时不会识别某些类。我认为这是西蒙所说的错误。

I heard there were some fixes in the trunk, but I also tried the latest trunk sources, but the same errors keep coming back. I think php without a opcode cacher (there is none available right now) is not production worthy. Hopefull the people at apc will fix this asap.

我听说主干中有一些修复,但我也尝试了最新的主干源,但同样的错误不断出现。我认为没有操作码缓存器的 php(现在没有可用的)不值得生产。希望apc的人能尽快解决这个问题。

UPDATE!!!

更新!!!

Xcache 2.0.0-rc1 is out and compatible with php 5.4. Enjoy!

Xcache 2.0.0-rc1 已发布并与 php 5.4 兼容。享受!

回答by JohnSmith

No, APC 1.3.9 (and as of this moment, even the svn trunk) isn't compatible with php 5.4.0, I know because I've just spent hours trying to get it to work (tested various svn/php.ini settings/compiler flags/you name it).

不,APC 1.3.9(截至目前,甚至是 svn 主干)与 php 5.4.0 不兼容,我知道是因为我刚刚花了几个小时试图让它工作(测试了各种 svn/php.ini)。 ini 设置/编译器标志/您命名)。

This is just ridiculous, APC is one of the most popular PHP extension and you'd expect after weeks of going through 8 PHP 5.4 RC's they'd have the time to get APC to work along side it.

这太荒谬了,APC 是最流行的 PHP 扩展之一,您会期望在经历了 8 个 PHP 5.4 RC 数周后,他们有时间让 APC 与它一起工作。

Pathetic.

可怜的。

回答by StXh

I found apcu http://windows.php.net/downloads/pecl/releases/apcu/

我找到了 apcu http://windows.php.net/downloads/pecl/releases/apcu/

Maybe this is apc for x64 on windows. It (version 4.0.1) worked on my application.

也许这是 Windows 上 x64 的 apc。它(版本 4.0.1)适用于我的应用程序。

回答by DevWL

I am using AMPPS with PHP Version 5.5.19. Since some time now exactly from release of PHP 5.5 - APC is replaced with Zend OPCache which is included in PHP 5.5 and up. Now all you have to do to enable "APC" (currently "OPcache") is to edit your php.ini. Before [XDebug] section add the flowing lines:

我在 PHP 5.5.19 版中使用 AMPPS。从 PHP 5.5 发布开始,APC 被 PHP 5.5 及更高版本中包含的 Zend OPCache 取代。现在您要启用“APC”(当前为“OPcache”)所需要做的就是编辑您的 php.ini。在 [XDebug] 部分之前添加流畅的线条:

php.ini

配置文件

...

[OPcache]

zend_extension=php_opcache.dll

opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=24
opcache.max_accelerated_files=4000
opcache.revalidate_freq=3
opcache.fast_shutdown=1

...

Please note that we need to have two instancesof:

请注意,我们需要有两个实例

zend_extension =

zend_extension =

One in [OPcache] and one in [XDebug] section. Xdebug is often not provided as default in your xampp/ampps/easyPHP server installation. You might find yourself in a situation where you will need to download Xdebug extension. You can do this easily by using an online application that defines the right Xdebug for your php. Visit http://xdebug.org/wizard.phpand follow their simple instructions. Once you have downloaded the right version of Xdebug for your php version - edit the link of your zend_extension in [XDebug] section.

一个在 [OPcache] 和一个在 [XDebug] 部分。在您的 xampp/ampps/easyPHP 服务器安装中,通常不提供 Xdebug 作为默认设置。您可能会发现自己需要下载 Xdebug 扩展。您可以使用在线应用程序轻松完成此操作,该应用程序为您的 php 定义了正确的 Xdebug。访问http://xdebug.org/wizard.php并按照他们的简单说明进行操作。一旦你为你的 php 版本下载了正确的 Xdebug 版本 - 在 [XDebug] 部分编辑你的 zend_extension 的链接。

...

[XDebug]
zend_extension = "C:\Program Files (x86)\Ampps\php\ext\php_xdebug-2.2.6-5.5-vc11.dll"
......

Please note! that you have to add OPcache section before XDebug in your php.ini file!!! If you follow me correctly you should have two instances of zend_extension in your php.ini file (one in OPcache and one in Xdebug section).

请注意!您必须在 php.ini 文件中的 XDebug 之前添加 OPcache 部分!!!如果你正确地跟随我,你的 php.ini 文件中应该有两个 zend_extension 实例(一个在 OPcache 中,一个在 Xdebug 部分)。

This works perfectly for Symfony2framework, and eliminates recommendation message to install and enable APC for your PHP and Xdebug.

这非常适用于Symfony2框架,并消除了为 PHP 和 Xdebug 安装和启用 APC 的建议消息。

Message to those who run symfony 2 and removed the warning message from "web/config.php", but still encounter a problem by running from command line "php app/check.php". If this happens, that means that your console is using a different php.ini file. Change your system PATH varible - make it point to the right php directory (where you have your php.exe file and which is used by your local server).

给那些运行 symfony 2 并从“web/config.php”中删除警告消息的人的消息,但从命令行“php app/check.php”运行仍然遇到问题。如果发生这种情况,则意味着您的控制台正在使用不同的 php.ini 文件。更改您的系统 PATH 变量 - 使其指向正确的 php 目录(您拥有 php.exe 文件并且由本地服务器使用)。

If you need deeper explanation let me know in the comment below. Regards.

如果您需要更深入的解释,请在下面的评论中告诉我。问候。

回答by Roberto

There seems to be some issues yet to be ironed out. Check out the bugsand you might be able to figure out what is the solution to your particular problem.

似乎还有一些问题有待解决。检查错误,您也许能够找出解决您的特定问题的方法。

I dealt with one such error some hours ago, and it turned out that using APC from the SVN trunk was the way to go. Hope this helps!

几个小时前我处理了一个这样的错误,结果证明使用来自 SVN 主干的 APC 是可行的方法。希望这可以帮助!

回答by Simon

I've found that you need to clear the opcode cache on each page request otherwise classes that implement interfaces fail to load. This was compiled from the latest svn trunk, Apache 2.4.1, PHP 5.4.0.

我发现您需要清除每个页面请求上的操作码缓存,否则实现接口的类将无法加载。这是从最新的 svn trunk、Apache 2.4.1、PHP 5.4.0 编译的。

回答by trante

APC - not recommended
Personally I didn't use APC with PHP 5.4 or PHP 5.5, but latest stable APC is not compatible with PHP 5.4, latest beta APC can be used with 5.4 but it is written that still have negative issues with APC.

APC - 不推荐
我个人没有将 APC 与 PHP 5.4 或 PHP 5.5 一起使用,但最新的稳定 APC 与 PHP 5.4 不兼容,最新的测试版 APC 可以与 5.4 一起使用,但据报道,APC 仍然存在负面问题。

If you have PHP 5.5
just use Zend Opcache. It is out of the box, so problems are minimum.

如果您有 PHP 5.5,
只需使用Zend Opcache。它是开箱即用的,因此问题最少。

If you have PHP 5.4
I recommend XCache. It is fully compatible with PHP 5.4 and 5.5. Actively developed. Last stable version was released 3.5 months ago (10 October 2013). It improves performance even if you use fastcgi.

如果你有 PHP 5.4,
我推荐XCache。它与 PHP 5.4 和 5.5 完全兼容。积极发展。最后一个稳定版本是在 3.5 个月前(2013 年 10 月 10 日)发布的。即使您使用 fastcgi,它也会提高性能。