Windows Server 2008 Web site access PHP response Slow workaround

Source: Internet
Author: User

The company on a new website, but after the configuration of the PHP environment but found the problem, access to HTML fast, and access to the PHP Web page will lag 1 seconds, the response is very slow appearance, excluding the bandwidth factor, in Baidu search a lap unexpectedly solved, and now will be reproduced method to everyone, In fact, the solution is very simple oh.

IIS7.5 Web site access PHP slow response reason

The reason is that PHP5.3 above support IPV6 protocol, but everyone's server does not use IPV6, we configure the database information is similar to the "$dbhost = ' localhost ', which itself is not a problem, Just when access to PHP will be connected to MySQL address localhost,php 5.3 will consider is IPV4 or IPV6, the system will first use IPV6 connection, but did not IPv6 so to wait until the IPv6 failed to go to IPv4 so around a circle, So the speed is slow, there is a lag.

IIS7.5 Web site access to PHP response slow workaround

Method 1: Use Notepad to open the Hosts file under C:\Windows\System32\drivers\etc.

Found it:

# 127.0.0.1 localhost

Modified to:
127.0.0.1 localhost

Save the Hosts file.

Method 2:hosts file does not move, directly modify the database configuration information. Change $dbhost= ' localhost ' to $dbhost= ' 127.0.0.1 '.

All right, let's try the effect.

Windows Server 2008 Web site access PHP response Slow workaround

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.