• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

PHP Connecting over 'localhost' to MySQL very slow

arisd

Basic Pleskian
Hi,

Since I could not find any solution over internet (none of them helped) I must turn to other users if anyone has solution.

I have windows server 2012 and Plesk v12.0.18 #30 - I noticed speed problem.

When I try to connect to mySQL with:
$conn = new mysqli('localhost', 'joomla_***', '*****', 'joomla_test');

Connection takes 1 second
!!!

When I try to connect with '127.0.0.1' instead of 'localhost' connection takes 0,009 seconds.

1. I tried solution to add line '127.0.0.1 localhost' to c:\windows\system32\drivers\ets\hosts - but no luck.
2. I tried to edit C:\Program Files (x86)\Parallels\Plesk\MySQL\Data\my.ini - adding lines
bind-address=127.0.0.1
skip-name-resolve
then restarted mySql but 1 second lag time on connection was still there.
3. I even tried to disable IPv6 but still no luck

Has anyone of you found solution to this problem - I guess all usesr windows windows server 2012 has the same problem??!?!...

Thanks, Aris.
 
Hi,

You mean to say you added both these lines at the same time to check?
--------
bind-address=127.0.0.1
skip-name-resolve
--------
 
Hi, InderS

Thank you for answer.

I tried just now added both lines to my.ini but still no luck - lag time remains - any more ideas?...

In first post i wrote wrong my.ini path - i corrected right my.ini:
C:\Program Files (x86)\Parallels\Plesk\Databases\MySQL\data\my.ini

You can see for yourself:
http://www.bojanornik.si/joomla/test-localhost.php
http://www.bojanornik.si/joomla/test-127.php

Any more ideas? Perhaps some PHP settings to force using 127.0.0.1 instead of localhost?
 
For future reference:

Solution 1 & 2 won't work. You really need to change the preference of IPv6 over IPv4 in Windows Server 2012. That very second lag you are referring to is the delay introduced by localhost resolving to a IPv6 address. You can do this easily:

http://community.spiceworks.com/how_to/36202-disable-ipv6-through-the-registry

Use (0x)20 instead of (0x)FFFFFFFF. 20 just changes the preference while FFFFFFFF is completely disabling IPv6 which you shouldn't want to.
 
Back
Top