Cannot install php7.2 on Ubuntu 16.04 - Connection to ppa.launchpad.net 91.189.95.83 timeout

1.8k Views Asked by At

I've successfully upgraded my AWS EC2 instance to Ubuntu16.04 and wanted to install php7.2 from ondrej/php

The problem is, I've been attempting this for the past 2 hours to no avail. I've ran apt-get update, and everytime I did that, it cannot connect to ppa.launchpad.net (91.189.95.83). It will timeout and I cannot get the http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease

# apt-get update
Hit:1 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease                    
Hit:3 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease                  
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]                                                
Err:5 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease                                                         
Could not connect to ppa.launchpad.net:80 (91.189.95.83), connection timed out
Fetched 109 kB in 2min 0s (909 B/s)                
Reading package lists... Done
W: Failed to fetch 
http://ppa.launchpad.net/ondrej/php/ubuntu/dists/xenial/InRelease  
Could not connect to ppa.launchpad.net:80 (91.189.95.83), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

I've tried to wget -O /dev/null http://ppa.launchpad.net/ondrej/php/ubuntu/dists/xenial/InRelease and it can download it. I've tried to ping 91.189.95.83 and it works. I'm just unable to do apt-get update and subsequently, apt-get install php7.2

Is there anyone who faced this problem and managed to resolve it?

2

There are 2 best solutions below

1
Danish Ali On

Update it using system settings > software update in ubuntu and after updating it run command

sudo apt-get update
0
NoelHunter On

I was able to make it work by increasing the timeouts and retries:

sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="60"

and adding the same options to the apt-get dist-upgrade

See: https://github.com/travis-ci/travis-ci/issues/9112