• 15
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I have a clean VPS, with Ubuntu 14.04 LTS x64. And Tried the following:

# Upgrade The Base Packages

apt-get update
apt-get upgrade -y

# Add A Few PPAs To Stay Current

apt-get install -y software-properties-common

apt-add-repository ppa:nginx/stable -y
apt-add-repository ppa:rwky/redis -y
apt-add-repository ppa:chris-lea/node.js -y
apt-add-repository ppa:ondrej/php5-5.6 -y

But then it fails at the last one:

root@xxx:~# apt-add-repository ppa:ondrej/php5-5.6 -y

gpg: keyring `/tmp/tmp9jdzm9kw/secring.gpg' created
gpg: keyring `/tmp/tmp9jdzm9kw/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp9jdzm9kw/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ond\xc5\x99ej Sur?" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 687, in addkey_func
    func(**kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 370, in add_key
    return apsk.add_ppa_signing_key()
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 261, in add_ppa_signing_key
    tmp_export_keyring, signing_key_fingerprint, tmp_keyring_dir):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 210, in _verify_fingerprint
    got_fingerprints = self._get_fingerprints(keyring, keyring_dir)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 202, in _get_fingerprints
    output = subprocess.check_output(cmd, universal_newlines=True)
  File "/usr/lib/python3.4/subprocess.py", line 605, in check_output
    output, unused_err = process.communicate(inputdata, timeout=timeout)
  File "/usr/lib/python3.4/subprocess.py", line 936, in communicate
    stdout = _eintr_retry_call(self.stdout.read)
  File "/usr/lib/python3.4/subprocess.py", line 487, in _eintr_retry_call
    return func(*args)
  File "/usr/lib/python3.4/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 92: ordinal not in range(128)

I couldn't figure out whats wrong. It's all pretty basic.

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

  • 12
Reply Report
      • 1
    • Thank you so much for your help. This was the only way I got it working. But why does Linux makes things so complicated? Can't there be a standard that must be followed so all work smoothly? I am not saying Windows is great as I am ditching it for Linux, but my god there is always something not working or throwing errors. It is so frustrating. Whatever my mood, I want to thank you for this perfect process.
    • You're welcome! Some distributions (especially customised server editions by VPS providers) are cooked as minimal, and do not include UTF-8 support packages for less space, resources as far as I can tell.
      • 1
    • Hm... It doesn't work Cannot add PPA: 'ppa:ondrej/php5-5.6'. Please check that the PPA name or format is correct.
      • 1
    • @Kirby It's because PPA name is changed. I've updated my answer accordingly. The one ppa ondrej/php now holds all PHP versions maintained by its author.

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) 
  • 4
Reply Report

Try the following:

  • Please remove if you already installed php5.

  • Now try to a fresh installation.

  • Run gedit /etc/apt/sources.list to add following codes:

    deb http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu trusty main 
    deb-src http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu trusty main
    

    Please careful to edit and add source code.

  • Save and update it. (1234)

    sudo apt-get update  
    
  • Now try to install php5.

After installed you should get php5-5.6.

  • 0
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags