0

I have a bootstrap website that runs on Debian 10 - php 7.4.25, httpd 2.4.52, mysqld 15.1 Distrib 10.5.12 which works perfectly.

I copied it to my CentOS 7 box, which has selinux running as permissive (temporarily). Php version is 7.4.26, Apache version is 2.4.6 and mariadb is version 15.1 Distrib 5.5.68-Mariadb.

When I try to run the site on CentOS 7, I get an error "call to a member function fetch_assoc() on bool" when I try to get data via mysql search. If I do the search manually via the cli, it works perfectly. I believe this must be a package program, but I've install the php74-mysql package as well as php74-php-pecl-mysql package.

Does anyone have any ideas? Thanks

kathyl
  • 1
  • 1

1 Answers1

0

"fetch_assoc() on bool", when executed on the result of a query, indicates the query failed. It would help you to add exception handling to your code, not continuing blindly.

Gerard H. Pille
  • 2,569
  • 1
  • 13
  • 11
  • Will do that. I"m trying to figure out why the same code works on Debian, just not on CentOS! Same database, etc. – kathyl Feb 15 '22 at 13:21
  • A configuration problem, privileges ... A programmer wanting to win time by skipping important code makes the people coming after him/her waste time. – Gerard H. Pille Feb 15 '22 at 13:40
  • Agreed. I was hoping someone might have encountered this before and have an idea of configuration fixes or at least things to check. I've already checked code, compared php and mysql versions, packages installed, etc. – kathyl Feb 15 '22 at 15:32
  • I hope you agree you have wasted your time? All you need to do is add a couple of lines to the php code to tell you what is wrong. You may show the current code, I'll tell you what to add. – Gerard H. Pille Feb 15 '22 at 16:38
  • "I was hoping someone might have encountered this before" A little search would have shown you that the number of people having encountered this, is legion. – Gerard H. Pille Feb 15 '22 at 16:42