Attached diff supports "timeout" for MySQLi. It would be nice to support this for MySQL, too.
Once MySQL supports it, PhabricatorSetupCheckDatabase should use "timeout" instead of manually setting ini_set('mysql.connect_timeout', 2);. Using an ini_set() dance may also be the only way to get this to work.