Home > Backend Development > PHP Tutorial > PHP connection mysql prompts Call to undefined function mysql_connect()_PHP tutorial

PHP connection mysql prompts Call to undefined function mysql_connect()_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:06:06
Original
1390 people have browsed it

Today I configured the php mysql environment in windows. I am very happy to test a piece of code and the result prompts Call to undefined function mysql_connect(), which proves that the database configuration was unsuccessful.

1. Copy the two files libmysql.dll and php5ts.dll in the php folder to system32 in the windows directory; or add D:php;D:phpext to the environment variables. These two directories are the PHP installation directory and the extension dll directory.
The code is as follows
 代码如下 复制代码

$conn = mysql_connect('localhost','root','password');

var_dump($conn);

?>

Copy code

$conn = mysql_connect('localhost','root','password');

var_dump($conn);

?>

 代码如下 复制代码

extension=php_mysql.dll
extension=php_mysqli.dll把前面的分号去掉


Basically change the configuration file php.ini

First make sure extension_dir = "./ext" in php.ini, this setting is the directory where php refers to the dll;
2. Modify php.ini in the windows installation directory and remove the semicolon in front of extension=php_mysql.dll; 3.extension_dir = "d:phpext (the file is in PHP.INI).

Look at the configuration of your php.ini and find it
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template