################
mysqli模块的安装
################
记得原来在编译php的已经已经加上参数
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
可后来找了一个,的确不存在mysqli.so,所以只能单独来编译mysqli了。
mysqli是优化过的mysql函数库,MYSQL版本不能低于4.1.12
cd /root/lamp/php-5.2.3/ext/mysqli
#####进入到mysqli的目录。
再用phpize生成configure文件:
/usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
#./configure --prefix=/usr/local/mysqli \
--with-php-config=/usr/local/php/bin/php-config \
--with-mysqli=/usr/local/mysql/bin/mysql_config
make
make test
make install
Installing shared extensions: /usr/local/php/lib/php/extensions/debug-non-zts-20060613/
然后在/usr/local/lib/php.ini
加上一句:
extension=/usr/local/php/lib/php/extensions/debug-non-zts-20060613/mysqli.so
重新启动apache即可看到已经加载mysqli成功。
测试Mysqli运行状况:
Vim mysqli.php
$mysqli = new mysqli("localhost", "my_user", "my_password", "dbname");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", $mysqli->host_info);
/* close connection */
$mysqli->close();
?>
阅读(2825) | 评论(0) | 转发(0) |