简体   繁体   English

Mysqli_stmt_get_result在PHP 5.5.3中返回致命错误

[英]Mysqli_stmt_get_result returning fatal error in PHP 5.5.3

I am running an apache2 local dev server with php 5.5.3 installed. 我正在运行安装了php 5.5.3的apache2本地开发服务器。 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". 我已经在php文档中阅读到get_result()方法需要MySQL本机驱动程序(mysqlnd),但是在MySQL网站上它说:“从PHP 5.4开始,mysqlnd库是所有PHP MySQL的php.net编译时默认值扩展名”。 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 无论如何我都尝试安装php5-mysqlnd,当我这样做时,它会覆盖以前的mysql和mysqli conf文件,导致我得到错误

Fatal error: Call to undefined function mysqli_connect()

and when I reinstall php5-mysql it removes the mysqlnd package. 当我重新安装php5-mysql时,它将删除mysqlnd软件包。 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? 我并不真的在乎安装软件包,我更想知道为什么mysqlnd在PHP 5.5.3中不被视为软件包,应该如何启用它? Thanks in advance! 提前致谢!

Apache 2 server on Ubuntu 13.10 running: 在Ubuntu 13.10上运行的Apache 2服务器:

[~]$ 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. 我已经将扩展名添加到位于/etc/php5/apache2/php.ini的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

Check your php.ini to check if the extension for MySQLi is uncommented.. An example of what it should look like would be: 检查您的php.ini以检查MySQLi的扩展名是否未注释。.它的外观示例如下:

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: 然后删除它,将更改保存到php.ini并通过调用重新启动apache:

/etc/init.d/apache restart

and if your not sure where php.ini is located, create a simple page with: 如果不确定php.ini的位置,请使用以下命令创建一个简单页面:

<?php
  phpinfo();
?>

and check the line: 并检查以下行:

Loaded Configuration File: dir/to/php.ini 加载的配置文件:dir / to / php.ini

Or even run phpinfo(); 甚至运行phpinfo(); to begin with and check: 首先检查:

在phpinfo中启用MySQLI

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM