Home >php教程 >php手册 >php连接mysql错误的配置方法介绍

php连接mysql错误的配置方法介绍

WBOY
WBOYOriginal
2016-06-13 09:52:28821browse

本文章来为php初学者介绍在php配置好之后连接mysql提示Call  to  undefined  function  \'mysql_connect()的解决办法。

先来按书上测试一下php连接mysql

 代码如下 复制代码

$link=mysql_connect('localhost','root','123456');
if(!$link) echo "失败!";
else echo "成功!";
mysql_close();
?>

运行代码出现:

Call  to  undefined  function  'mysql_connect()'…

错误了失败

百度找到结果是PHP+MYSQL 环境没配置好, php5 的默认 mysql 是关闭的

将php_mysql.dll和libmysql.dll文件拷贝至c:/winnt/system32中(我漏了libmysql.dll)

找到php.ini中的;extension=php_mysql,去掉前面的";" 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn