SQLSTATE[HY000] [2002] Failed to create unix socket
近期测试服突然报这个问题,做下记录
刚开始还以为该问题是mysql数据库造成的,排查时发现数据库本地连接是正常的
接着在网上找了些文章,反馈可能是nginx造成
参考:
https://www.cnblogs.com/luoahong/articles/9139888.html
https://blog.csdn.net/qq_33203749/article/details/109405964
该报错还引发了如下错误:
1、strtotime(): Timezone database is corrupt - this should *never* happen!
2、redis server went away
3、缓存写入失败:/var/www/html/******.php
解决如下:
1、检查了服务器nginx和php-fpm的连接方式:
vim /etc/php-fpm.d/www.conf
vim /etc/nginx/conf.d/vhosts.conf
去这两个文件检查连接方式
127.0.0.1:9000
2、重启
systemctl restart nginx
systemctl restart php-fpm