1

Long time lurker, first time asker.

Quick version: I'm getting 500 errors on a LAMP site following an apt-get upgrade, which I can best trace back to Codeigniter's Query Builder.

Long version:

Codebase: Codeigniter 3.1.5 (upgraded as part of troubleshooting)

Local environment (works fine): XAMPP 7.0.3 / PHP 7.0.21 / MariaDB 10.1.25

Production environment (returns error): PHP 7.0.21 / MySQL Ver 14.14 Distrib 5.7.19

Depending on the page, I get a 500 HTTP error. Logs show various versions of this:

PHP Fatal error:  Call to a member function result() on a non-object in /var/www/application/models/Model.php on line xxx

Each of these errors refers to a piece of Codeigniter Query Builder code similar to:

$query = $this->db->query([some query]);
return $query->result();

or

$this->db->group_by([some other field]);
$query = $this->db->get();
return $query->result();

I can't find any consistent patterns across my use of query builder, though $this->db->group_by() seems to be popular.

Each error suggests that there's a problem with the query object but - again - it's inconsistent and confusing.

Steps to resolve:

  • Attempted to get version parity across environments
  • Rolled back the apt-get upgrade
  • Re-did apt-get upgrade
  • Upgraded Codeigniter from 3.1.3 to 3.1.5
  • Did a bunch of googling

I'm stumped. Any help or insight is appreciated.

1 Answer 1

1

Did more digging and was able to get a further error message in MySQL. This lead me here: Disable ONLY_FULL_GROUP_BY.

Followed the steps and was able to resolve the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.