由于php_network_getaddresses更新PHP错误失败错误

So this morning I discover my website payment forms where breaking and on further investigation I discovered that it would appear that my server (Ubuntu 14.4) is unable to connect to the outside world, namely:

Running from CLI:

$php composer.phar self-update

[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Name or service not known failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known

or a dig:

$ dig www.google.com

; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> www.google.com ;; global options: +cmd ;; connection timed out; no servers could be reached

Apache:

exception 'ErrorException' with message 'stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known'  

Similar posts on stack: here would suggest I change name servers...

So I am thinking that I should set up the server to use googles name servers: nameserver 8.8.8.8 nameserver 8.8.4.4

How is this done on Ubuntu 14.4 ?