PHP curl的DNS解析有关问题(PHP下curl很慢)

WBOY
Release: 2016-06-13 11:52:25
Original
2002 people have browsed it

PHP curl的DNS解析问题(PHP下curl很慢)

问题:

1 在项目中使用curl函数调用某个接口,发现响应很慢

2 修改host地址为接口服务器的ip地址,响应非常快

?

首先,在其他服务器上做了个DNS服务,希望能加快DNS解析速度(内网解析),尝试时候发现系统curl很快,但是用php curl函数执行还是非常慢.

?

在php脚本中对接口域名进行解析,通过gethostbyname()函数,发现对应的ip还是原来的ip,并不是我们重新解析的,原来PHP缓存了DNS的解析,当我们重新解析了域名之后,没有重启php,导致用的还是原来的DNS解析内容.

?

解决:

? ?重启php ,问题解决.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!