localhost

时间:2017-06-20 07:52:21

标签: php codeigniter

此问题此前已在此处提出,但我无法找到一个好的解决方案。 Very high latency in first HTTP request on CodeIgniter project

第一个请求(文档请求)需要花费大量时间(大约一分钟)。我不知道问题是什么,我也不知道要粘贴哪些代码,以便更容易找到错误。此问题是特定于项目的,不会与其他项目一起发生。我已经尝试了很多,但无法找到解决方案。请让我知道我应该提供什么,以便解决问题。提前致谢。 Please find the screenshot of the request timelist here

2 个答案:

答案 0 :(得分:0)

在httpd.conf中设置ServerName属性修复了延迟(最差时间最长为10秒)

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
ServerName 127.0.0.1:80

还要检查/ etc / hosts是否正确?

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

这会有所帮助。

答案 1 :(得分:0)

好的,我终于找到了答案。我的CI应用程序无法查询数据库。另外我的constants.php文件指向prod数据库。我将constants.php更改为指向localhost并更改了database.php以适合本地数据库。