PHP connection MySQL prompt call to undefined function mysql_connect ()

Source: Internet
Author: User
Tags ini
The code is as follows Copy Code

<?php

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

Var_dump ($conn);

?>

The basic is to change the configuration file php.ini

First, make sure that the Extension_dir = "./ext" in PHP.ini, which is the directory of PHP referencing DLLs;

1. Copy the PHP folder under Libmysql.dll and Php5ts.dll two files to the system32 under the Windows directory, or add D:php;d:phpext to the environment variable. These directories are the directories of the PHP installation directory and the extension DLL.
2. Modify the php.ini removed from the Windows installation directory; Extension=php_mysql.dll before the semicolon;
3.extension_dir = "D:phpext (file in php.ini).

You look at the configuration of your php.ini to find

The code is as follows Copy Code

Extension=php_mysql.dll
Extension=php_mysqli.dll, remove the semicolon from the front.


I'm using Apache, so if you still have this line, then look at the path and references in the main configuration file are set up without Phpinidir "PHP." INI path "also want to add a sentence of loadmodule************* content this on-line can find." In general, it can be solved basically here.

Find your PHP root directory, find two files Libmysql.dll and php5ts.dll copy them to System32 below. Remember to be under PHP. It's not MySQL.

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.