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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content