Upgrading from php5 to php7 utf8 locale error

After trying everything I could possibly find I am unable to solve my issue

I am following this tutorial on DO on how to upgrade from php5 to php7

The problem: Immediately on the first step when I execute “add-apt-repository ppa:ondrej/php”

I am given a warning error add-apt-repository is broken with non-uft-locales see

I already tried apt-get install -y language-pack-en-base LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Here’s a summary from a solution from Sakshi’s Oracle blog that works for Ubuntu:

sudo locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales

then edit /etc/default/locale and add LC_ALL and LANGUAGE with values “en_US.UTF-8”, like this


Now try the locale command.