0
votes

I am running an apache2 local dev server with php 5.5.3 installed. For some reason I am getting the error

Fatal error: Call to undefined function mysqli_stmt_get_result()

on all my pages. I have read on the php documentation that the get_result() method requires the MySQL Native Driver (mysqlnd), however on the MySQL website it says "As of PHP 5.4, the mysqlnd library is a php.net compile time default to all PHP MySQL extensions". I have tried installing php5-mysqlnd anyways and when I do it overwrites my previous mysql and mysqli conf files, causing me to get the error

Fatal error: Call to undefined function mysqli_connect()

and when I reinstall php5-mysql it removes the mysqlnd package. I'm not really concerned with installing the packages I am more wondering why mysqlnd isn't recognized as a package in PHP 5.5.3 as it should be, and how can I enable it? Thanks in advance!

Apache 2 server on Ubuntu 13.10 running:

[~]$ php5 --version
PHP 5.5.3-1ubuntu2 (cli) (built: Oct  9 2013 14:49:12) 
Copyright (c) 1997-2013 The PHP Group

[~]$ mysql --version
mysql  Ver 14.14 Distrib 5.5.34, for debian-linux-gnu (x86_64) using readline 6.2

EDIT:

I have already added the extensions to my php.ini file located at /etc/php5/apache2/php.ini. The file reads:

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so

extension=/usr/lib/php5/20121212/curl.so
extension=/usr/lib/php5/20121212/json.so
extension=/usr/lib/php5/20121212/mysqli.so
extension=/usr/lib/php5/20121212/mysql.so
extension=/usr/lib/php5/20121212/mysqlnd.so
1
you still need to enable the mysqli extension.goat

1 Answers

5
votes

Check your php.ini to check if the extension for MySQLi is uncommented.. An example of what it should look like would be:

extension=php_ldap.dll
;extension=php_mssql.dll
;extension=php_mbstring.dll
;extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll

If this has a ; then remove this, save the changes to php.ini and restart apache by invoking:

/etc/init.d/apache restart

and if your not sure where php.ini is located, create a simple page with:

<?php
  phpinfo();
?>

and check the line:

Loaded Configuration File: dir/to/php.ini

Or even run phpinfo(); to begin with and check:

MySQLI Enabled in phpinfo