最近安装zabbix用来监控本站运行状况,使用php7,nginx作为zabbix的web服务,遇到了一些问题,记录下来
一、权限问题
错误日志:
FastCGI sent in stderr: “PHP message: PHP Warning: require_once(/etc/zabbix/web/maintenance.inc.php): failed to open stream: Permission denied in /usr/share/zabbix/include/classes/core/ZBase.php on line 269
路径名称:/etc/zabbix/web
错误日志:
[error] 2481#0: *3 FastCGI sent in stderr: “PHP message: PHP Fatal error: Uncaught Exception: Cannot start session. in /usr/share/zabbix/include/classes/core/CSession.php:50
路径名称:/var/lib/php/session与/var/lib/php/wsdlcache
二、开机启动不成功
错误日志:
[Z3001] connection to database ‘zabbix’ failed: [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
原因:Mysql启动慢于Zabbix-server,将zabbix设在mysql之后启动
修改zabbix-server.service文件
Unit项下面添加
After=mysqld.service
三、登陆web页面后出现错误
错误提示:
A non well formed numeric value encountered [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CView->getOutput() → include() → make_status_of_zbx() → CFrontendSetup->checkRequirements() → CFrontendSetup->checkPhpMemoryLimit() → str2mem() in include/func.inc.php:410]
A non well formed numeric value encountered [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CView->getOutput() → include() → make_status_of_zbx() → CFrontendSetup->checkRequirements() → CFrontendSetup->checkPhpPostMaxSize() → str2mem() in include/func.inc.php:410]
A non well formed numeric value encountered [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CView->getOutput() → include() → make_status_of_zbx() → CFrontendSetup->checkRequirements() → CFrontendSetup->checkPhpUploadMaxFilesize() → str2mem() in include/func.inc.php:410]
解决方法:
sed -i '/$last = strtolower(substr($val, -1));/a$val = substr($val,0,-1);' /usr/share/zabbix/include/func.inc.php
centos7.4+nginx1.12.2+mariadb10.2+php7.2,zabbix3.4,遇到同样的问题。感谢分享!