Windows,XAMPP,PHP 7和opcache [英] Windows, XAMPP, PHP 7 and opcache

查看:327
本文介绍了Windows,XAMPP,PHP 7和opcache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了最新的XAMPP服务器以及PHP 7 (更新:还检查了PHP 7.1)(在我的 Windows 10 系统上).想要使用 opcache ,所以我在php.ini中启用了它.

I've installed latest XAMPP server with PHP 7 (update: checked also PHP 7.1) (on my Windows 10 system). Wanted to use opcache, so I enabled it in php.ini.

[opcache]
zend_extension=php_opcache.dll
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000

现在有了这种更改,并且几乎每个页面都刷新了,我从Apache得到了这个错误:

With that change now, and with almost every page refresh, I'm getting this error from Apache:

AH00428: Parent: child process 3748 exited with status 3221226356 -- Restarting.

因此,页面正在加载,并且正在加载...等待Apache重新启动.当我关闭opcache(通过设置opcache.enable=0)时,Apache无法重新启动,并且一切正常(当然,省去了较慢的Web应用程序主题).

So, page is loading, and loading... waiting to Apache start again. When I'm turning opcache off (by setting opcache.enable=0), Apache is not restarting and everything works fine (omitting the slower web application topic, of course).

在启用了opcache的PHP 5.6的XAMPP上加载应用程序时,一切正常.

Everything works fine while loading app on XAMPP having PHP 5.6 with enabled opcache.

修改(已添加GIF图片):
如您所见,有时页面会刷新.但是有时它的刷新时间更长,而Apache在那一刻重新启动.

EDIT (added GIF image):
As you can see, sometimes page refreshes like it should. But sometimes it's refreshing much longer, and Apache is restarting in that moment.


老实说,我放弃了这个应用程序,而在Windows上使用PHP(在PHP≤5.6的环境下工作了大约10年). (现在)使PHP 7.x在该OS(带有Opcache)上运行非常困难/不可能.决定使用 Ubuntu 和使用 Docker 创建的服务器.一切都易于配置(尤其是使用Docker),并且运行速度更快.我建议每个人都做同样的事情;).


To be honest, I gave up with this application and working with PHP on Windows (was working on it for around 10 years with PHP <= 5.6). It's very hard/impossible (for now) to make PHP 7.x work on that OS (with Opcache). Decided to go with Ubuntu and server created with Docker. Everything is easier to configure (especially with Docker) and works faster. I advise everyone to do the same ;).

推荐答案

您的php_opcache.dll 路径似乎错误,您需要像下面这样编写,对我有用.

Your php_opcache.dll path seems wrong, you need write it like below, it works for me.

[opcache]
zend_extension=C:\xampp\php\ext\php_opcache.dll
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=256
opcache.max_accelerated_files=2000

更多详细信息

如果您的XAMPP默认情况下随附PHP 5.5+,并且捆绑包中已包含opcache,则只需启用它即可.要启用扩展程序:

More details

If your XAMPP comes with PHP 5.5+ by default, opcache already included in the bundle, you will just need to enable it. To enable the extension:

  1. 打开php.ini(默认情况下应位于此处:C:\ xampp \ php \ php.ini).

  1. Open php.ini (by default it should be located here: C:\xampp\php\php.ini).

在文件末尾添加以下行: zend_extension=C:\xampp\php\ext\php_opcache.dll

Add this line at the end of the file: zend_extension=C:\xampp\php\ext\php_opcache.dll

这篇关于Windows,XAMPP,PHP 7和opcache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆