Today to learn PHP connection to MySQL, using the mysql_connect () function, encountered the following error:
"Call to undefined function mysql_connect ()",
PHP Version: 5.4.29
MySQL version: 5.5.28
Apache Version: 2.2.22
Here's how to fix it:
1, in httpd.conf:
LoadModule php5_module "D:/www/php54/php5apache2_2.dll"
Phpinidir "D:/WWW/PHP54"
Description
The first sentence is to load the PHP5 module, D:/WWW/PHP54 is the root directory of my php5.4
The second sentence is to tell Apache to load the php.ini path, php.ini in the D:/WWW/PHP54 directory
2, in php.ini:
Display_errors = On
Extension_dir = "D:/www/php54/ext"
Extension=php_mysql.dll
Description
The first sentence is to open PHP error printing, otherwise you can not see the error (this sentence and connection to MySQL)
The second sentence indicates the path of PHP to load the extension DLL module, which is important
The third sentence is the MySQL support module that loads PHP
3. Restart Apache,ok