When php connects to mysql, the following message is displayed: Calltoundefinedfunctionmysql_connect () _ PHP Tutorial.

Source: Internet
Author: User
When php is connected to mysql, Calltoundefinedfunctionmysql_connect () is displayed (). I configured the phpmysql environment in windows today. I'm glad to test a piece of code that prompts Calltoundefinedfunctionmysql_connect (). This proves that the database configuration is not successful. The code is as follows. Today, the php mysql environment is configured in windows. we are glad to test a piece of code that prompts Call to undefined function mysql_connect (). This proves that the database configuration is not successful.
The code is as follows:

$ Conn = mysql_connect ('localhost', 'root', 'password ');

Var_dump ($ conn );

?>

The configuration file php. ini is changed.

First, make sure that extension_dir = "./ext" in php. ini is the directory where php references dll;

1. copy the libmysql. dll and php5ts. dll files in the php folder to system32 in the windows directory, or add D: php; D: phpext to the environment variable. These two directories are the php installation directory and the extension dll directory.
2. modify php. ini in the windows installation directory and remove the semicolon before extension = php_mysql.dll;
3. extension_dir = "d: phpext (file in PHP. INI ).

Look at your php. ini configuration.

The code is as follows:

Extension = php_mysql.dll
Extension = php_mysqli.dll remove the semicolon


I use apache, so if this line is still in use, check whether the path and reference in the main configuration file are set, without PHPIniDir "PHP. the INI path "can be found online with the LoadModule. Generally, this can be basically solved here.

Find your PHP root directory and find the libmysql. dll and php5ts. dll files to copy them to system32. Remember that it is under PHP. Not MYSQL

In the prepare mysql environment, we are glad to test a piece of code and the prompt "Call to undefined function mysql_connect ()" indicates that the database configuration is not successful. The code is as follows...

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.