Home  >  Article  >  Backend Development  >  Introduction to the incorrect configuration method of php connection to mysql_PHP tutorial

Introduction to the incorrect configuration method of php connection to mysql_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:50:54905browse

This article will introduce to PHP beginners the solution to the prompt Call to undefined function mysql_connect() when connecting to mysql after PHP is configured.

First, let’s test the php connection to mysql according to the book

Baidu found that the PHP+MYSQL environment is not configured properly, and the default mysql of php5 is closed
The code is as follows
 代码如下 复制代码

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

Copy code

$link=mysql_connect('localhost','root','123456'); if(!$link) echo "Failed!";

else echo "Success!";

mysql_close(); ?>

Running the code appears:

Call  to  undefined  function  'mysql_connect()'…


Error failed

Copy the php_mysql.dll and libmysql.dll files to c:/winnt/system32 (I missed libmysql.dll)

Find ;extension=php_mysql in php.ini and remove the ";" in front of it
http://www.bkjia.com/PHPjc/632612.htmlwww.bkjia.com
truehttp: //www.bkjia.com/PHPjc/632612.htmlTechArticleThis article will introduce to php beginners how to connect to mysql after php is configured. Call to undefined function 'mysql_connect() solution. First, let’s test the php connection to mysql according to the book. The code is like...
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