测试 写一个页面test.php,放在apache的web目录下,测试上面用命令创建的数据库
<?php $mysqli=new mysqli(); $mysqli->connect('localhost','root','123456','gywtest'); // 创建查询 $sqlstr='select * from student'; //发送查询给MySql $result=$mysqli->query($sqlstr); while($row=$result->fetch_object()) { $name=$row->stuname; echo $name; }?>
Fatal error: Class 'mysqli' not found in /home/lufangtao/Project/DB.php on line 3
解决方法:
/usr/local/php/bin/phpize 这里回车运行
出错:
Cannot find config.m4. Make sure that you run './phpize' in the top level source directory of the module
解决方法:
PHP源码包文件夹下的EXT文件夹就是放置着目前版本的可用扩展,CD进去看看都有哪些你需要的?应该看到mysqli文件夹了吧~~~
在当前目录下执行phpize
[root@localhost mysqli]#/usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Modeule Api No: 20090626
Zend Extension Api No: 220090626
Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.