Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.