[ZBX-6645] Installation wizard produce unfriendly error message when testing database connection Created: 2013 May 30  Updated: 2017 May 30  Resolved: 2013 Jul 01

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.1.0
Fix Version/s: 2.1.0

Type: Incident report Priority: Trivial
Reporter: jabalv Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: installation
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File php_error_messages.txt    
Issue Links:
Duplicate
duplicates ZBX-1983 entered values for ports are not prop... Closed

 Description   

At configure DB connection step, when "Database host" field contain wrong,bad database hostname, then php error appears. Need more friendly error message.

Error message in attached file.



 Comments   
Comment by Oleksii Zagorskyi [ 2013 May 31 ]

Why it is still not closed as duplicate ?

Comment by richlv [ 2013 May 31 ]

it's not a dupe, actually - here, port is checked, but we still attempt the connection...

Comment by jabalv [ 2013 May 31 ]

Port validation results ignored, still performing connection to wrong port:

mysql_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known [include/db.inc.php:77]
mysql_connect(): [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (trying to connect via tcp://asd:99999) [include/db.inc.php:77]
mysql_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known [include/db.inc.php:77]
Error connecting to database [php_network_getaddresses: getaddrinfo failed: Name or service not known]
Warning. Incorrect value for field "Port": must be between 0 and 65535. 

Strange values in port field appears, when negative port number specified:

mysql_connect(): [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (trying to connect via tcp://asd:4294957297) [setup.php:111 → CsetupWizard->__construct() → CsetupWizard->EventHandler() → CsetupWizard->CheckConnection() → DBconnect()
Comment by Ivo Kurzemnieks [ 2013 Jun 21 ]

For step 3:

  • Added empty validation for field "Database host";
  • If there are warnings, fields didn't pass validation and connection test will show up as Fail;
  • If no warings are shown, fields passed validation and connection test will begin 1;
  • If connection to database failed, only connection error message and reason is shown. PHP error messages are suppressed. This is done by temporarily setting error_reporting Off and back On.

1 Note: not all possible entries in fields "Database host" and "Database name" are checked. I can still input various symbols like !#$%9'=+ and they will be valid.

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-6645

Comment by Toms (Inactive) [ 2013 Jun 26 ]

(1) I believe error suppression should be done as well for ORACLE, DB2 and SQLLITE.

iivs RESOLVED in r36601

oleg.egorov CLOSED

Comment by Toms (Inactive) [ 2013 Jun 26 ]

(2) I suggest that error suppression should be done using @, but this should be discussed.
Current solution in not good as we could decide at some point that we want to suppress some PHP errors, but after connection they will be turned back on.

iivs RESOLVED in r36601

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2013 Jul 03 ]

TESTED

Comment by Ivo Kurzemnieks [ 2013 Jul 04 ]

Fixed in pre-2.1.0 (trunk) r36707

Generated at Thu Apr 25 20:01:58 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.