I am trying to install ppa:ondrej/php on Ubuntu 16.04

When I enter the command:

sudo add-apt-repository ppa:ondrej/php

It gives me this message:

Cannot add PPA: 'ppa:~ondrej/ubuntu/php'.
ERROR: '~ondrej' user or team does not exist.


Even I am not able to install any PPA. How do I proceed?

  • please run sudo apt update && sudo apt dist-upgrade Dec 23 '16 at 11:19
  • I have ran sudo apt update && sudo apt dist-upgrade command. even reinstalled OS. Dec 23 '16 at 11:24
  • Maybe there was a (temporary?) problem with the internet connection at the Launchpad end or at your end. I checked, the ppa and the team exist at Launchpad.
    – sudodus
    Dec 23 '16 at 11:52
  • @sudodus I have another system installed with Ubuntu14.04 with same internet connection, but that works fine regarding installing ppas, but the system with 16.04 is not working fine. Dec 23 '16 at 12:28

A bit late but someone might find it helpful: I had this problem when I set HTTP_PROXY= but forgot to set HTTPS_PROXY=.


I had a similar problem, albeit with 17.04, but eventually determined it was actually a CA certificate problem.
SSL Certificate error when adding PPA has some solutions to this type of problem.

In my case I eventually determined my company had recently switched to an SSL inspect scheme for all external web traffic, and they were were Man-in-the-middleing all https traffic. They did this by replacing all external server certificates with internally generated ones signed by an internal root signing authority. For machines that had that internal root certificate already populated it was fine working fine, but since I was doing a fresh install I had to manually add the root signing authorities to my system's ca certificates.

  • Exactly this happened to me. Thanks for you answer.
    – Al-Alamin
    Aug 30 '19 at 9:50
  • I had to add our company CA certs as well. Thanks!
    – codelogn
    Nov 20 '20 at 22:37

I tested in a live Ubuntu 16.04.1 LTS and I get ppa:ondrej/php without problems.

But there was a warning, that might explain your problem: "add -apt-repository is broken with non-UTF-8 locales, see github.com/oerdnj/deb.sury.org/issues/56 for workaround"

[my comment: Scroll and you will see the following code, that you can try.]

apt-get update &&
apt-get install -y language-pack-en-base &&
export LC_ALL=en_US.UTF-8 &&
export LANG=en_US.UTF-8 &&
apt-get install -y software-properties-common &&
add-apt-repository -y ppa:ondrej/php5-5.6 &&
add-apt-repository -y ppa:ondrej/mariadb-10.0 && 
apt-get update && 
apt-get -y upgrade

If that does not work, read the link carefully and look for other tips and tricks.

  • Again, today i have reinstalled with Ubuntu 15.10. and the problem still exist. didn't find anything to get out of it. $ sudo add-apt-repository ppa:noobslab/screenlets Cannot add PPA: 'ppa:~noobslab/ubuntu/screenlets'. ERROR: '~noobslab' user or team does not exist. Dec 26 '16 at 11:19
  • The version 15.10 has passed end of life and is no longer supported. It is easier to get help with 16.04.1 LTS. If it is does not work with any ppa, I think there is something wrong with your installed system or with the internet connection. Please test in a live system, booted from an Ubuntu DVD disk or USB pendrive.
    – sudodus
    Dec 26 '16 at 16:22
  • I had a problem with NO_PUBKEY, see this link to solve -> chrisjean.com/…
    – Doglas
    Jul 31 '19 at 19:08

I have the same problem but with elementary os based on ubuntu 16.04. The problem comes after installing some certificates and did not resolve when I have removed the certificates even with sudo apt-get install --reinstall ca-certificates or sudo dpkg-reconfigure ca-certificates . The solution I found was to completely remove the ca-certificates and install it again instead of using --reinstall .

sudo apt remove --purge ca-certificates
sudo apt autoremove
sudo apt install ca-certificates

and because the autoremove removed software-properties-common I have to install it again by typing

sudo apt install software-properties-common

After all these steps I can add repositories, use git pull and sudo apt update without any problems.

  • as I've already mentioned above, that command did not change anything in my case. I've tried it few times but no change until I did --purge of the ca-certificates.
    – Bo rislav
    Dec 27 '17 at 15:22

actually, you may have problems with config proxy. Try this one:

unset http_proxy
unset ftp_proxy
unset https_proxy

Check they have been removed by:

env | grep -i proxy

Now try add-apt-repository


I had this problem and it was because DNS was not working.

Fixed with:

echo "" >> "/etc/resolv.conf"
echo "nameserver" >> "/etc/resolv.conf"
echo "nameserver" >> "/etc/resolv.conf"
echo "nameserver 2001:4860:4860::8888" >> "/etc/resolv.conf"

This is the only thing that worked for me:

Reinstall certificates

sudo apt-get install --reinstall ca-certificates

And if you're behind a proxy, set the proxy.

Installing the repo manually did not work, but reinstalling the certs did.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.