Search code examples
phpcpanelmysqlnd

Unable to use mysqlnd methods


I am creating a WebService using Slim framework in php. it works well for POST REQUEST but when I use GET REQUEST I come across error stating

Call to undefined method mysqli_stmt::get_result()

I've created another file for testing purpose. which contains the code below. As in the first check I find that extension is loaded but my second check goes false as I check any native method of mysqlnd

if (extension_loaded('mysqlnd')) {
echo 'mysqlnd enabled!';
}
  $mysqlnd = function_exists('mysqli_fetch_all');
 if($mysqlnd) {

   echo 'function exists';
}

My PHP version is PHP Version 5.5.31.


Solution

    • If you have administrator privileges on your cPanel machine.
      • If you're running EasyApache 3: You need to re-run EasyApache and enable the mysqlnd and mysqli extensions, making sure to disable "Mysql of the system" option. You can find that in the Extended Options screen.
      • If you're running EasyApache 4: You need to install the ea-php55-php-mysqlnd package. You can do that using WHM >> EasyApache 4, or via command-line (yum install ea-php55-php-mysqlnd).
    • If you do not have administrator privileges, you need to ask your administrator to add both mysqlnd and mysqli.
      • If your administrator says that mysqlnd and/or mysqli is already installed, then you want to add "extension=mysqlnd.so" and "extension=mysqlnd_mysqli.so" to your php.ini file.