Reference

Named Pipe Support Broken in PHP 5.3.x on Windows

Named pipe support is apparently broken in PHP 5.3.x on Windows.

Tags: database infrastructure mysql php

Overview

When upgrading from PHP 5.2.x or earlier the following error message may appear in the PHP error log:

PHP Warning:  mysql_connect() [<a href='function.mysql-connect'>
    function.mysql-connect</a>]: php_network_getaddresses:
    getaddrinfo failed: No such host is known.

Solution

There is no solution at the time of this writing. The workaround is to enable TCP/IP networking in MySQL and modify mysql_connect() to connect to localhost instead. To enable TCP/IP connections, comment out or remove the following line in the my.ini configuration file for MySQL:

skip-networking

It is also recommended to limit incoming MySQL connections to localhost, if applicable:

bind-address=127.0.0.1

Please note that the default port for MySQL Server is 3306, and you may have to update your server’s firewall settings accordingly.

Related Resources

The problem was first pointed out on the php-bugs mailing list. It has also been noted in the user comments of the official PHP manual. A fix is not planned for PHP 5.3.x, but may be forthcoming for PHP 5.4.x or later according to the bug report.

An in-depth tutorial on securing MySQL Server on Windows can be found on the MySQL Developer Zone.