我不知道发生了什么,但是当用户试图在我的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: xxxx, 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"
在我的所有主机上启用Pagespeed以及清漆。
Vhostconfiguration:
[...] # 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)(/.+)$; }
OPcacheconfiguration:
[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
编辑:
在Debian GNU/Linux 7.8上使用PHP 5.6.5-1~dotdeb.1 Varnish 4.0.2
EDIT2:
禁用了pagespeed并尝试了xcache nginx报告503和php-fpm worker重新启动。
它只适用于如果我完全禁用caching在PHP中
EDIT3:
按照Jakov Sosic的build议做出核心转储后,结果如下:
[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.
你可以尝试解决这个问题的一种方法是获取PHP的coredump(在它发生segfaults之后),然后使用GDB(在系统上安装debuginfo软件包)分析coredump。 那么你可以看到什么确切的PHP行让你头痛。
除此之外 – 没有任何人可以在这一个build议你。
http://www.omh.cc/blog/2008/mar/6/fixing-apache-segmentation-faults-caused-php/
在检查了我发现的问题后, opcache错误是由缺less的文件触发的,但这不是问题。
我的PHP版本安装没有zend thread safetyfunction。 在用zts安装php之后,现在一切正常。