php-mysql connection fails with the error "Can't connect to MySQL server on 'example.com' (13)"

Solution Verified - Updated -

Issue

  • Unable to make connections to mysql databases through apache/php. Same connection from CLI ( Command line Interface) works.

  • php connection to  mysql server fails with the following message :

    Can't connect to MySQL server on 'example.com' (13)
    

Environment

  • Red Hat Enterprise Linux 5
  • php- 5.3.2-6.el6_0.1
  • mysql-5.1.52-1.el6_0.1 

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.