Upgrade php requests and wait for longer response time

Source: Internet
Author: User
In an old php project, after the php version is upgraded to 5.4.x, the request response becomes slow. In firebug, check that the wait time for the response is greater than 1 s. In the local test environment, the project is not large, there is very little data and there should be no such slow response speed. It is important that the same code works normally before php is upgraded, and the response time is not so long. Upgraded

In an old php project, after the php version is upgraded to 5.4.x, the request response becomes slow. In firebug, check that the wait time for the response is greater than 1 s. In the local test environment, the project is not large, there is very little data and there should be no such slow response speed. It is important that the same code works normally before php is upgraded, and the response time is not so long. Upgraded

In an old php project, after the php version is upgraded to 5.4.x, the request response becomes slow. In firebug, check that the wait time for the response is greater than 1 s. In the local test environment, the project is not large, there is very little data and there should be no such slow response speed. It is important that the same code works normally before php is upgraded, and the response time is not so long. The upgraded performance cannot be worse.

It has been verified that it is related to ipv4 and ipv6. PHP 5.3 and later versions detect ipv4 or ipv6 when encountering localhost, so the response time is too long.

The configuration related to database connections in the project is usually defined in this way.

// MySQL server address
Define ("dbserver", "localhost ");

In many cases, our web server and database server are the same computer, so they are set to localhost, which is the cause of slow response.

The solution is simple. You can replace localhost with 127.0.0.1, so that it is clear that it is an ipv4 address, without the time and effort of php over there.

Define ("dbserver", "127.0.0.1 ");

Let's see if our website is flying fast.
Related Articles

This article from: http://flyash.itcao.com, original address: http://www.itcao.com/post_1266.html, thanks to the original author to share.

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.