@DaveRandom I have to use unix sockets since I'm using twitter realtime api and it works only with the unix socket.The DSN looks like this:
db_socket: 'mysql:unix_socket=/cloudsql/-----:us-central1:----database-main'
db_host: '----'
db_name: '---'
db_user: '----'
db_password: '---'
$connection = new PDO($config['db_socket'].';dbname='.$config['db_name'].';',$config['db_user'],$config['db_password']);