PHP Segfault报502错误

环境

LCMP:https://github.com/teddysun/lcmp

  • PHP:8.4
  • MariaDB:11.4
  • Caddy:2.10
  • WordPress:6.8.2

症状

LCMP安装完成后,安装WordPress,安装UpdraftPlus,恢复备份,全部网页报错。

Caddy日志

{"level":"error","ts":1753333690.020887,"logger":"http.log.error.log1","msg":"EOF","request":{"remote_ip":"xxx.xxx.xxx.xxx","remote_port":"xxxxx","client_ip":"xxx.xxx.xxx.xxx","proto":"HTTP/2.0","method":"GET","host":"fivyex.com","uri":"/favicon.ico","headers":{"X-Forwarded-For":["xxx.xxx.xxx.xxx"],"Accept-Encoding":["gzip, br"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"],"Referer":["https://fivyex.com/?swcfpc=1"],"Priority":["u=1, i"],"Sec-Fetch-Mode":["no-cors"],"Cf-Ray":["9640e5ed1c4ef60b-ORD"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Fetch-Site":["same-origin"],"Cookie":["REDACTED"],"Cf-Ipcountry":["US"],"Sec-Ch-Ua":["\"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"138\", \"Google Chrome\";v=\"138\""],"Cdn-Loop":["cloudflare; loops=1"],"Accept":["image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"],"Sec-Ch-Ua-Platform":["\"Windows\""],"Cf-Connecting-Ip":["xxx.xxx.xxx.xxx"],"X-Forwarded-Proto":["https"],"Accept-Language":["zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"],"Dnt":["1"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Fetch-Dest":["image"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"fivyex.com"}},"duration":0.095020129,"status":502,"err_id":"u6n92ejm7","err_trace":"reverseproxy.statusError (reverseproxy.go:1390)"}

MariaDB日志

Jul 23 22:08:10 warm-light-6.localdomain mariadbd[543]: 2025-07-23 22:08:10 18 [Warning] Aborted connection 18 to db: 'wordpress' user: 'wordpress' host: 'localhost' (Got an error reading communication packets)

PHP日志

php-fpm[13454]: segfault at 563eda614e70 ip 00007f2bd7313a8c sp 00007ffd389af5f0 error 6 in opcache.so[7f2bd72f5000+b8000]

解决

先问ChatGPT,得到了几个可能出问题的PHP插件

全部禁用后,网站恢复正常,逐个启用,发现开opcache就会炸

又问了谷歌,发现这篇文章:https://stackoverflow.com/questions/66446842/what-is-causing-a-segfault-when-opcache-file-cache-is-enabled-in-a-symlink-deplo

按文章说的,在/etc/php/${php_ver}/fpm/pool.d/www.conf里面把php_value[opcache.file_cache] = /var/lib/php/opcache这行注释掉,就OK了

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理