iis+php MySQL undefined function mysql_connect ()

Source: Internet
Author: User
Tags ini mysql tutorial php file php mysql save file

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".

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.