UnicodeDecodeError in Ubuntu while installing PHP5.6 from PPA

Solution 1:

The proper way is to enable UTF-8 support in your terminal.

First check your locales:

locale -a

Then, install an UTF-8 locale, for en_US, the example as follows:

locale-gen en_US.UTF-8

Then you need to export it:

export LANG=en_US.UTF-8

Then the add-apt-repository command will work okay.

If this still doesn't still work, try using this line:

LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php

Solution 2:

I faced the same problem. I think the error comes because of the non western characters in the name (Ond\xc5\x99ej Sur�).

Make sure you removed php5.

You can add the repository manually:

# echo "deb http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu trusty main" > /etc/apt/sources.list.d/ondrej-php5-5_6-trusty.list

# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C

# apt-get install php5

Check with php -v whether you have 5.6 installed:

# php -v
PHP 5.6.6-1+deb.sury.org~trusty+1 (cli) (built: Feb 20 2015 11:22:10)