Score:0

apache 2.4.6 site works on Debian 10 but not on CentOS - php 7 code

pg flag

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

Score:0
in flag

"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.

kathyl avatar
pg flag
Will do that. I"m trying to figure out why the same code works on Debian, just not on CentOS! Same database, etc.
Gerard H. Pille avatar
in flag
A configuration problem, privileges ... A programmer wanting to win time by skipping important code makes the people coming after him/her waste time.
kathyl avatar
pg flag
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.
Gerard H. Pille avatar
in flag
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 avatar
in flag
"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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.