Development Tools Using PHP with MySQL Connecting PHP to MySQL Handling Exceptions

Craig Skipsey
Craig Skipsey
2,865 Points

Warning displayed before "Cannot connect to database" message when testing exception handling. Why? (OSX / XAMPP)

Warning message is displayed before "Cannot connect..." message when testing the exception handling - see output

Warning: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Applications/XAMPP/xamppfiles/GWD/database.php on line 4 Could not connect to the database

Why is this happening? How can you suppress warning messages?

1 Answer

Aaron Munoz
Aaron Munoz
11,177 Points

That's an added feature MAMP has to display errors for developers, if I'm not mistaken.