OPcache 破坏了 phpBB 注册

OPcache 破坏了 phpBB 注册

我不知道发生了什么,但是每当用户尝试在我的 phpBB 论坛之一上注册自己时,nginx 就会抛出502 Bad gateway,但如果我禁用 OPcache,一切都会正常工作。

这是来自的错误日志php-fpm

WARNING: [pool www] child 14677 exited on signal 11 (SIGSEGV) after 87782.968736 seconds from start

这是nginx错误日志:

[error] 14099#0: *78984 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: x.x.x.x, server: x, request: "POST /ucp.php?mode=register HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "x.tld", referrer: "https://x.tld/ucp.php?mode=register"

我的所有主机和 Varnish 上都启用了 Pagespeed。

Vhost 配置:

[...]

# PageSpeed
pagespeed on;

pagespeed MemcachedThreads 1;
pagespeed MemcachedServers "localhost:11211";

#Varnish
pagespeed DownstreamCachePurgeLocationPrefix https://x.tld:80;
pagespeed DownstreamCachePurgeMethod PURGE;
pagespeed DownstreamCacheRewrittenPercentageThreshold 95;

pagespeed EnableFilters combine_javascript;
pagespeed EnableFilters combine_css;
pagespeed EnableFilters move_css_above_scripts;
pagespeed EnableFilters prioritize_critical_css;
pagespeed FileCachePath              "/var/cache/pagespeed/";
pagespeed MapRewriteDomain https://x.tld http://x.tld;

[...]

location ~ \.php$ {
  include fastcgi_params;
  fastcgi_index index.php;
  fastcgi_pass   unix:/var/run/php5-fpm.sock;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
}

OPcache 配置:

[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=30000
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.revalidate_freq=1
opcache.fast_shutdown=1
opcache.optimization_level=0

我尝试将整个论坛目录列入黑名单,但只有完全禁用 OPcache 才能奏效

编辑:

使用PHP 5.6.5-1~dotdeb.1Debian GNU/Linux 7.8 Varnish 4.0.2

编辑2:

已禁用pagespeed并尝试xcachenginx 报告503php-fpm worker重新启动。
只有当我完全禁用 php 中的缓存时,它才有效

编辑3:

按照 Jakov Sosic 的建议进行核心转储后,结果如下:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php-fpm: pool www                                                     '.
Program terminated with signal 11, Segmentation fault.
#0  _zend_mm_free_int (heap=0xf122c0, p=0x7f895b07c980) at /usr/src/php5.6/nonzts/source/dotdeb-php5/Zend/zend_alloc.c:2104
2104    /usr/src/php5.6/nonzts/source/dotdeb-php5/Zend/zend_alloc.c: No such file or directory.

答案1

尝试解决该问题的一种方法是获取 PHP 的核心转储(在它出现段错误之后),然后使用 GDB(系统上安装了 debuginfo 包)分析核心转储。然后,您就有可能看到究竟是哪一行 php 让您头疼。

除此之外,没有人能就此事给你太多建议。

http://www.omh.cc/blog/2008/mar/6/fixing-apache-segmentation-faults-caused-php/

答案2

检查完问题后,我发现opcache错误是由文件丢失引起的,但问题不在这里。
我安装的 php 版本没有该zend thread safety功能。使用 zts 安装 php 后,现在一切正常。

相关内容