Home > Article > Backend Development > PHP connection mysql connection is reset solution_PHP tutorial
After installing a new Windows 7 64-bit system, I configured a lot of things, and I always had this and that feeling. Yesterday when I started configuring php+apache, echo phpinfo() was completely fine, but once I connected to mysql, it would not work. Presents the problem of the page being reset. It turned out that the problem was not big, but I came to a misunderstanding:
1. I suspected a problem with the 64-bit system;
2. I felt that the code was unreliable, because it can be executed in other places, and a casual substr() can also be displayed
came out...
This problem has been bothering me for more than a day, but I still haven't solved it. In desperation, I used "php connection mysql connection was reset" as the keyword to search, and it appeared. After searching for a lot of scattered information one by one, someone finally mentioned that it was due to the reference problem of libmysql.dll. I read it with great excitement and followed it. Maybe I was even willing to restart my computer because I was afraid that the cache there would be wasted. It was finally solved later. ----------This incident made me realize the importance of misunderstandings. I post the solutions here, hoping that people who encounter them can use them.
Try copying libmysql to windows/system32 and copy libmysql.dll to apache/bin.
Of course, the easiest way is:
In apache:
LoadFile D:/PHP/php5.2.13/libmysql.dll
With just the above line, mysql can be successfully called.
My server version: win7
apache 2.2.13
php 5.2.13
mysql5.1.37
phpmyadmin3.3.2
The following is my apache department configuration.
PHPIniDir D:/PHP/php5.2.13 #Not required
LoadFile D:/PHP/php5.2.13/php5ts.dll
LoadFile D:/PHP/php5.2.13/libmysql.dll
LoadModule php5_module D:/PHP/php5.2.13/php5apache2_2.dll
AddType application/x-httpd-php .php