Okay...I'm confused. I thought you were originally saying that the problem was that nothing was being output; but now you are saying you do, in fact, get an error. 😕
If you google the SQLSTATE[HY000] [2002] Connection refused message, it appears to indicate that either you cannot connect to the specified database server for some reason, or it is not listening for requests on the default port number that PHP/PDO is assuming. If the latter, then you need to specify the desired port number as part of the PDO dsn string, e.g. something like:
'mysql:host=mysqlserver.no;port=6789;mydbname=mydb' (changing the 6789 to whatever the correct port number should be)
Otherwise, verify that the host name is correct and that it is accessible from wherever you are testing this?