PHP files displaying error

When i use a .php file i have uploaded, the following error always displays “ERROR: Could not connect. No such file or directory”.

I have a config file that i require in others and the error always displays

What are you trying to do there, what you connecting to?

Based on the message, I suspect you’re trying to connect to the MySQL server using the hostname localhost. However, you cannot use that hostname here. Please check your control panel for the correct database hostname.