mysql - yii database host check -


how can check whether database host valid?

  try {      yii::app()->db;   } catch (exception $ex) {      echo $ex->getmessage();   } 

code above gives me error when use invalid host address:

pdo::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known. 

i want receive returns false, display own error message


Comments