我的PHP环境是5.4,使用mysql时突然出现以下错误: mysql_connect(): Headers and client library minor version mismatch. Headers:50508 Library:50166 索性换成mysqlnd扩展,下面简单介绍mysqlnd: mysqlnd(MySQL native driver for PHP)是php5.3后php自
我的php环境是5.4,使用mysql时突然出现以下错误:
mysql_connect(): headers and client library minor version mismatch. headers:50508 library:50166
mysqlnd(MySQL native driver for PHP)是php5.3后php自带的mysql驱动,官方推荐使用,优势如下:
A.libmysql驱动是由mysql AB公司(现在是oracle公司)编写, 并按mysql license许可协议发布,所以在PHP中默认是被禁用的.
而mysqlnd是由php官方开发的驱动,以php license许可协议发布,故就规避了许可协议和版权的问题
B.因为mysqlnd内置于PHP源代码,故你在编译安装php时就不需要预先安装mysql server也可以提供mysql client API (mysql_connect, pdo , mysqli), 这将减化一些工作量.
C. mysqlnd是专门为php优化编写的驱动,它使用了PHP本身的特性,在内存管理,性能上比libmysql更有优势. php官方的测试是:libmysql将每条记录在内存中保存了两份,而mysqlnd只保存了一份
立即学习“PHP免费学习笔记(深入)”;
D. 一些新的或增强的功能
新秀B2C商城系统是一款简洁易用PHP商城系统。可免费下载使用,可用于商业用途,没有时效限制,除版权标识外,所有代码都允许修改。后台功能简介:1、商城设置:基本信息,配送方式,配送范围,支付方式,财务管理;2、商品管理:商品列表,添加商品,商品分类,商品品牌,商品属性;3、订单管理:订单列表,缺货登记;4、用户互动:用户管理,留言管理,评论管理,网站公告,在线客服,用户协议;5、文章管理:文章列表
0
增强的持久连接
引入特有的函数mysqli_fetch_all()
引入一些性能统计函数 mysqli_get_cache_stats(), mysqli_get_client_stats(),
mysqli_get_connection_stats(),
使用上述函数,可很容易分析mysql查询的性能瓶颈!
SSL支持(从php 5.3.3开始有效)
压缩协议支持
--with-mysql=/usr/local/mysql
[root@localhost php54]#./configure --help | grep mysql
--with-mysql=DIR Include MySQL support. DIR is the MySQL base
mysqlnd the MySQL native driver will be used
--with-mysql-sock=SOCKPATH MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
--with-mysqli=FILE Include MySQLi support. FILE is the path
to mysql_config. If no value or mysqlnd is passed
--enable-embedded-mysqli MYSQLi: Enable embedded support
--with-pdo-mysql=DIR PDO: MySQL support. DIR is the MySQL base directory
If no value or mysqlnd is passed as DIR, the
--enable-mysqlnd Enable mysqlnd explicitly, will be done implicitly
--disable-mysqlnd-compression-support
Disable support for the MySQL compressed protocol in mysqlnd
--with-zlib-dir=DIR mysqlnd: Set the path to libz install prefix./configure --prefix=/usr/local/php54 --with-config-file-path=/usr/local/php54/etc --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --with-curl --with-curlwrappers --enable-fpm --with-mcrypt --with-gd --with-openssl --with-mhash --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc -enable-zip --enable-soap--with-mysql --with-pdo-mysql --with-mysqli
原文地址:PHP使用mysqlnd驱动, 感谢原作者分享。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号