My localhost rendering pages were slow. Everything even simple html rendering was taking around 2-5 seconds. I researched on it and got it fixed by replacing:
new \PDO(... ':host=localhost' ...);
to
new \PDO(... ':host=127.0.0.1' ...);
can anyone explain to me or give me a link to read why localhost was slowing down and how just changing it into IP made it very fast. Right now it renders even complex queries less than a second when it was taking around 5-10 seconds before.
And also is there any security issue by replacing localhost with IP? I mean if i host my project live and i replace localhost with the IP of the host will it have affect on any kind of security?
thanks alot