一个WHMCS偶发性500错误,登陆后台也偶发性提示数据库错误,查看错误日志:
Smarty Error: SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘=’ (SQL: select count(`tblorders`.`id`) as aggregate from `tblorders` inner join `tblorderstatuses` on `tblorders`.`status` = `tblorderstatuses`.`title` where `tblorderstatuses`.`showpending` = 1)
了解了一波是因为两个数据表排序规则不对导致。
tblorders = utf8_general_ci
tblorderstatuses = utf8_unicode_ci
在utf8_general_ci执行以下命令,修改为utf8_unicode_ci 让其排序正确。
ALTER TABLE tblorders CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
参考文档:https://help.whmcs.com/m/troubleshooting/l/1040457-troubleshooting-a-blank-admin-dashboard-after-updating