Home > Backend Development > PHP Tutorial > IIS+PHP mysql undefined function mysql_connect()_PHP教程

IIS+PHP mysql undefined function mysql_connect()_PHP教程

WBOY
Release: 2016-07-13 10:47:39
Original
946 people have browsed it

IIS+PHP cannot load MYSQL undefined function mysql tutorial_connect()
In many php tutorials, beginners will get an undefined function mysql_connect() error message when they first php mysql. Let's analyze the reasons below.

1.
Remove the ";" in front of the following parameters in PHP.ini:
;extension=php_dba.dll
;extension=php_gd2.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_pdo.dll
;extension=php_pdo_mysql.dll
Save the file and restart IIS

Specific instructions

Put
in php.ini ;extension=php_mysql.dll
Change to
extension=php_mysql.dll

extension_dir = " "
Change to
extension_dir = "ext/ "

Copy libmysql.dll to system32 and finally restart it

Test whether php mysql can connect

$link=mysql_connect( 'localhost ', 'root ', '123456 ');
if(!$link) echo "fail ";
else echo "success ";
mysql_close();
?>

2.

1.php_info() Check if there is a mysql item (search for the "mysql" keyword). If it is possible, it may be a version compatibility issue
2. If the libmysql.dll in the php file is not copied to x:windowssystem32, remove the comment of the mysql module in php.ini with extension=php_mysql.dll. Restart apache. If it still doesn’t work, restart the machine and try to test using the php_info() function. test.

Right click on My Computer->Properties->Advanced->Environment Variables->System Environment Variables
a. Select Path in "System Environment Variables" to highlight this line, then select "Edit" and add ";D:php" (the directory where php.exe is located) at the end of the variable value
b. "System environment variables"->"New"->Variable name "PHPRC"->Variable value "D:php" (the directory where php.ini is located)->
2. Check the PhpIniDir setting in the httpd.conf file to point to the Php directory.
3. Try to change PhpIniDir="C:/Php" in httpd.conf to PhpIniDir="C:Php".

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632851.htmlTechArticleIIS+PHP cannot load MYSQL undefined function mysql tutorial_connect() In many php tutorials, beginners will use php for the first time When using mysql, an undefined function mysql_connect() error message appears, as follows...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template