iis+php cannot load MySQL undefined function mysql tutorial _connect ()
In many PHP tutorials beginners will come out in the first php MySQL undefined function mysql_connect () error prompts, below we analyze the reasons.
One
Remove the words ";" in front of the following parameters in the 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 file, restart IIS
Specific description
PHP.ini inside the
; Extension=php_mysql.dll
Change into
Extension=php_mysql.dll
Extension_dir = ""
Change into
Extension_dir = "ext/"
Then copy the Libmysql.dll to the system32 and restart it.
Test whether PHP MySQL can connect
<?php
$link =mysql_connect (' localhost ', ' root ', ' 123456 ');
if (! $link) echo "fail";
else echo "Success";
Mysql_close ();
?>
Two
1.php_info () Check if there is a MySQL (search "mysql" keyword), if it is possible version compatibility issues
2. If you do not copy the PHP file Libmysql.dll to the X:windowssystem32 under the php.ini of the MySQL module in the comments removed Extension=php_mysql.dll restart Apache if not yet Reboot the machine and try the test using the Php_info () function.
Right-click My Computer-> Properties-> Advanced-> environment variable-> system environment variable
A. Select path in system environment variable to make this line highlighted and select Edit to add ";D: PHP" at the end of the variable value (Php.exe directory)
B. "System environment variable"-> "new"-> variable name "PHPRC"-> variable Value "d:php" (php.ini directory)->
2. See the Phpinidir settings in the httpd.conf file to point to the PHP directory.
3. Try to change the phpinidir= "c:/php" in the httpd.conf into Phpinidir= "c:php".