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.