trouble installing php-ldap on debian 9

rumplesmyboy asked:

I’m trying to install php-ldap on a mediawiki image that uses php:7.2-apache for my Kubernetes deployment. I’ve already ran apt-get update and tried adding the ppa.

apt-get install php-ldap
    php7.3-ldap 7.3.4-1+0~20190412071350.37+stretch~1.gbpabc171 [Not candidate version]
      php7.2-ldap 7.2.17-1+0~20190412071344.20+stretch~1.gbp23a36d [Not candidate version]
      php7.1-ldap 7.1.28-1+0~20190412071216.17+stretch~1.gbpbe9b36 [Not candidate version]
      php7.0-ldap 7.0.33-6+0~20190412071436.12+stretch~1.gbp26747c [Not candidate version]
      php5.6-ldap 5.6.40-6+0~20190412071127.13+stretch~1.gbp7ce36b [Not candidate version]
      php7.3-ldap 7.3.4-2 [Not candidate version]
      php7.0-ldap 7.0.33-0+deb9u3 [Not candidate version]
      php7.0-ldap 7.0.33-0+deb9u1 [Not candidate version]

    E: Package 'php-ldap' has no installation candidate


> add-apt-repository ppa:ondrej/php  Co-installable PHP versions: PHP
> 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for
> Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are
> provided. Don't ask for end-of-life PHP versions or Ubuntu release,
> they won't be provided.
> 
> Debian oldstable and stable packages are provided as well:
> https://deb.sury.org/#debian-dpa
> 
> You can get more information about the packages at
> https://deb.sury.org
> 
> BUGS&FEATURES: This PPA now has a issue tracker:
> https://deb.sury.org/#bug-reporting
> 
> CAVEATS:
> 1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
> 2. If you are using apache2, you are advised to add ppa:ondrej/apache2
> 3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline    or ppa:ondrej/nginx
> 
> PLEASE READ: If you like my work and want to give me a little
> motivation, please consider donating regularly:
> https://donate.sury.org/
> 
> WARNING: add-apt-repository is broken with non-UTF-8 locales, see
> https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
> 
> # LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php  More info: https://launchpad.net/~ondrej/+archive/ubuntu/php Press [ENTER] to
> continue or ctrl-c to cancel adding it
> 
> gpg: keybox '/tmp/tmpnxnei5m6/pubring.gpg' created gpg:
> /tmp/tmpnxnei5m6/trustdb.gpg: trustdb created gpg: key
> 4F4EA0AAE5267A6C: public key "Launchpad PPA for Ond\xc5\x99ej Sur�"
> imported gpg: Total number processed: 1 gpg:               imported: 1
> Exception in thread Thread-1: Traceback (most recent call last):  
> File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
>     self.run()   File "/usr/lib/python3.5/threading.py", line 862, in run
>     self._target(*self._args, **self._kwargs)   File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py",
> line 688, in addkey_func
>     func(**kwargs)   File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 386,
> in add_key
>     return apsk.add_ppa_signing_key()   File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 263,
> in add_ppa_signing_key
>     tmp_export_keyring, signing_key_fingerprint, tmp_keyring_dir):   File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line
> 212, in _verify_fingerprint
>     got_fingerprints = self._get_fingerprints(keyring, keyring_dir)   File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line
> 204, in _get_fingerprints
>     output = subprocess.check_output(cmd, universal_newlines=True)   File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
>     **kwargs).stdout   File "/usr/lib/python3.5/subprocess.py", line 385, in run
>     stdout, stderr = process.communicate(input, timeout=timeout)   File "/usr/lib/python3.5/subprocess.py", line 788, in communicate
>     stdout = self.stdout.read()   File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
>     return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position
> 223: ordinal not in range(128)

My answer:


Note that this warning appeared on your screen:

WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php  More info: https://launchpad.net/~ondrej/+archive/ubuntu/php Press [ENTER] to
continue or ctrl-c to cancel adding it

Because you didn’t rerun the command in the format specified, you got the error.

To solve the problem, do what the message said to do:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.