Mysql undefined function mysql_connect () is prompted when PHP is connected to the database under IIS ()

Source: Internet
Author: User
Tags php mysql

I,
Remove the ";" before the following parameters in PHP. ini:
Copy codeThe 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
Description
In php. ini
; Extension = php_mysql.dll
Change
Extension = php_mysql.dll
Extension_dir = ""
Change
Extension_dir = "ext /"
Copy libmysql. dll to system32 and restart later.
Test whether php mysql can be connected
<? Php
$ Link = mysql_connect ('localhost', 'root', '123 ');
If (! $ Link) echo "fail ";
Else echo "success ";
Mysql_close ();
?>
II,
1. Check whether mysql exists in php_info () (search for the "mysql" keyword). If any, it may be caused by version compatibility problems.
2. if you do not set libmysql in the PHP file. dll copy to x: windowssystem32 to copy php. remove extension = php_mysql.dll from the comment of the mysql module in ini to restart apache. If not, restart the machine and try to test the function using php_info.
Right-click my computer> Properties> advanced> environment variables> system environment variables
A. Select Path in "system environment variables" to make the line highlighted. Then select "edit" and add "; D: \ php#(php.exe directory) at the end of the variable value)
B. "system environment variables"-> "new"-> variable name "PHPRC"-> variable value "D: \ php" (directory of php. ini)->
2. view the PhpIniDir settings 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 ".

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.