Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.