Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqli_fetch_all stopped working on PHP 5.4.11

Tags:

php

mysqli

I have a basic site with a host and as of recent the mysqli_fetch_all command has appeared to have stopped working as I receive the message:

Fatal error: Call to undefined function mysqli_fetch_all() in file at line where function is used

I rolled back the files on the server to a set that I know work and yet I run into the same issue even though the page is running PHP5.4+.

I cannot figure out why this has suddenly stopped working. Offline, using XAMPP, the mysqli_fetch_all command works perfectly and therefore the issue doesn't seem to be with the DB or the code. I would prefer not to rewrite numerous pages with a while loop for an unknown reason.

Is this an issue with the server host? Any help would be most appreciated.

like image 266
mjbk88 Avatar asked Oct 04 '22 22:10

mjbk88


1 Answers

There are two ways the MySQLi extension may be compiled:

  1. By linking it against MySQL's client library
  2. By compiling against the MySQL Native Driver that is bundled with php (mysqlnd)

mysqli_fetch_all() is only available in the second case, see http://php.net/mysqli_fetch_all

I would recommend to avoid such mysqlnd-only functions for compatibility reasons. If compatibility is not an issue for you and you desperately need this function, you have to recompile php --with-mysqli=mysqlnd.

like image 126
Alexander M. Turek Avatar answered Oct 10 '22 03:10

Alexander M. Turek