WINDOWS7 environment Apache connection mysql Prompt "Connection reset" workaround

Source: Internet
Author: User
Tags connection reset

Win7 under the manual build Wamp environment, encountered several pits summarized under,

1. Normal access to PHP and HTML type files, but access to the project file is always connected to be reset, and then summarized as a database problem, write test cases test PHP can successfully call the database,

1<?PHP2    Echo"MySQL";3 4    $mysql _conf=Array(5' Host ' = ' 127.0.0.1 ',6' db ' = ' drupal628 ',7' Db_user ' = ' root ',8' Db_pwd ' = ' admin ',9     );Ten     $mysql _conn= @mysql_connect($mysql _conf[' Host '],$mysql _conf[' Db_user '],$mysql _conf[' Db_pwd ']); One     if(!$mysql _conn) { A         EchoFailed; -          die("Could not connect to the database:\n".Mysql_error());//Diagnosing Connection Errors -}Else{ the         Echo"Connection succeeded"; -     } -  -?>
MySQL Test
1<?PHP2    Echo"Mysqli";3 4   $mysql _conf=Array(5' Host ' = ' 127.0.0.1 ',6' db ' = ' drupal628 ',7' Db_user ' = ' root ',8' Db_pwd ' = ' admin ',9     );Ten  One     $mysqli= @NewMysqli ($mysql _conf[' Host '],$mysql _conf[' Db_user '],$mysql _conf[' Db_pwd ']); A     if($mysqli-Connect_errno) { -         EchoFailed; -          die("Could not connect to the database:\n".$mysqli-&GT;CONNECT_ERROR);//Diagnosing Connection Errors the}Else{ -         EchoSuccess; -     } -  +?>
mysqli Test

The actual is mysqli can connect successfully, MySQL connection is not successful, phpinfo.php also display module has been loaded normally, baffled its solution, until find the answer of the great God.

Workaround 1:

    • Added in Apache configuration file httpd.conf: LoadFile D:/php/php5.2.13/libmysql.dll (Good try, I don't have 2 errors)
    • Modify the \windows\system32\drivers\etc\hosts file, point localhost to 127.0.0.1 (due to Windows7 resolvable IPv6, default localhost point is:: 1 not 127.0.0.1)

2. Cannot automatically locate the homepage

Add DirectoryIndex index.html index.php in httpd.conf <directory "F:/php_projects" ></Directory> default.html default.php Specify default home page

WINDOWS7 environment Apache connection mysql Prompt "Connection reset" workaround

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.