0

This question has been asked here before but I can't find a good solution. Very high latency in first HTTP request on CodeIgniter project

The first request (document request) takes a lot of time (around a minute). I dont know what the issue is and neither do I know what code to paste here so that it will be easier to find the mistake. This issue is project specific and doesn't occur with other projects. I have tried a lot but cant find a solution. Please let me know what should I provide so that the issue can be solved. thanks in advance. Please find the screenshot of the request timelist here

Rachit
  • 208
  • 4
  • 19

2 Answers2

0

Setting up the ServerName property in httpd.conf fixed the delays (they were up to 10 seconds at worst)

# 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

Also check if /etc/hosts is correct?

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

This will be helpful.

Alex Mac
  • 2,970
  • 1
  • 22
  • 39
  • Only this particular codeigniter project doesn't work. Other projects are working which means this has nothing to do with httpd.conf and /etc/hosts file. Am I right? – Rachit Jun 20 '17 at 10:06
  • yes , If others are working fine then there will be some issue in codeigniter setup. Have you used Caching in CI..? Can you add below mentioned line in your login function and check. `$this->output->cache(1);` – Alex Mac Jun 20 '17 at 10:31
  • Yes, I have used caching in the CI. Now, it shows that "An error occurred while trying to load the resource." – Rachit Jun 20 '17 at 10:40
  • I have shared it. Please have a look and let me know the solution . Thank you so much. – Rachit Jun 21 '17 at 02:42
  • Cah you please share this `login_check()` and `language_setting()` function.? – Alex Mac Jun 21 '17 at 04:47
  • Yeah i have pasted the code for that as well. i have search the whole internet but still couldn't find anything. Seems like the problem persists only on Mac but not on Windows. – Rachit Jun 21 '17 at 08:47
0

Okay I finally found the answer. My CI app was not able to query the database. Plus my constants.php file was pointing to prod database. I changed the constants.php to point to localhost and changed database.php for suit the local database.

Rachit
  • 208
  • 4
  • 19