Win7sp1: set up the PHP environment. PHP cannot connect to mysql. it is strange that the reason cannot be found. my local mysql can be completely connected under cmd to create a database and a data table. everything is normal, but I cannot connect with PHP. let's talk about my environment first.
Win7sp1 64, php5.2.5 apache2.2
Php and apache have been integrated. The final configuration of APACHE is as follows:
LoadModule php5_module "D:/service/php/php5apache2_2.dll"
PHPIniDir "D:/service/php"
AddType application/x-httpd-php. php
However, there is no mysql information in phpinfo. I found it myself, and some said it was a HOST file problem. I added 127.0.0.1 to localhost, and then installed it on a virtual machine. PHP. INI has enabled mysql and mysqli modules. I don't know where the problem is.
If mysql_connect () is used for connection, a problem occurs in the mysql_connect function.
In PHP, the location of EXT is correct. the EXT directory also contains the php_mysql.dll file. please help me analyze what the problem will be. thank you very much.
Reply to discussion (solution)
This is the PHPINFO information.
Remove the mysql entry from the environment variable, or insert the php path to the mysql entry.
Remove the mysql entry from the environment variable, or insert the php path to the mysql entry.
The two methods are the same. After mysql is removed from the environment variables, mysql cannot be used in cmd, and PHPINFO still does not have the mysql option, after inserting the php path in front of mysql, cmd can connect to mysql, but phpinfo still cannot find mysql.
Will it be another cause? it's so painful. I couldn't find the cause. I dreamed about it last night.
Don't use 5.25 anymore ....
You have a complete installation package.
Http://www.apachefriends.org/zh_cn/xampp.html
I will try to configure this environment later.
PHP failed to load mysql. Check whether the extension path is correct.
If php fails to load the mysql extension Library, the message mysql_connect () is not defined.
Try to copy the php_mysql.dll and libmysql. dll files to c: \ winnt \ system32.
Refer
Download the WampServer, which is available on 32-bit 64-bit devices.
If php fails to load the mysql extension Library, the message mysql_connect () is not defined.
Try to copy the php_mysql.dll and libmysql. dll files to c: \ winnt \ system32.
Refer
You can follow this method. In summary, you do not need to copy php_mysql.dll and libmysql. dll files to the system32 directory. in apache, you must specify the directory location of php, and then add the directory of PHP to the system environment variables, I can see that the PATH of Apache Environment in my post does not display the PHP PATH. another important point is to restart the system instead of restarting apache after adding Environment variables, then OK. thank you.
Come and learn.