Home > Backend Development > PHP Tutorial > PHP connection database under IIS prompts mysql undefined function mysql_connect()_PHP tutorial

PHP connection database under IIS prompts mysql undefined function mysql_connect()_PHP tutorial

WBOY
Release: 2016-07-21 15:37:03
Original
1004 people have browsed it

1.
Remove the ";" in front of the following parameters in PHP.ini:

Copy the code The code is as follows:

;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
Place ;extension=php_mysql.dll
Change to
extension=php_mysql.dll
extension_dir = " "
Change to
extension_dir = "ext/"
Then change libmysql.dll Copy it to system32 and then 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 mysql (search for the "mysql" keyword), if there may be a version compatibility issue
2. If you have not copied the libmysql.dll in the php file to x:windowssystem32, change the mysql module in php.ini Comment out extension=php_mysql.dll and restart apache. If it still doesn't work, try restarting the machine and test using the php_info() function.
Right-click My Computer->Properties->Advanced->Environment Variables->System Environment Variables
a. Select Path in "System Environment Variables" to highlight this line, and 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 that the PhpIniDir setting in the httpd.conf file points to the directory of Php.
3. Try to change PhpIniDir="C:/Php" in httpd.conf to PhpIniDir="C:Php".

http://www.bkjia.com/PHPjc/322010.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322010.htmlTechArticle1. Remove the ";" in front of the following parameters in PHP.ini: Copy the code as follows: ; extension=php_dba.dll;extension=php_gd2.dll;extension=php_mbstring.dll;extension=php_m...
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