I'm running a perfect server on CentOS 6.8. I recently added PHP 7.0 and 7.1. When I switched over sites, I began getting database errors. Code: mysqli_real_connect(): (HY000/2002): No such file or directory Changing 'localhost' to '127.0.01' resolves the error and allows everything to function properly. I first got the idea to try from this question on StackOverflow. In my opinion, this is just a workaround. What's the real solution? Using "localhost" should work.