user1657394
user1657394

Reputation: 299

Zend framework 1.11 - SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'localhost' (111)

My application zend framework does not connect in the bank, but a simple php script connects successfully.

Error zend framework SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'localhost' (111)

My simple php script

<?
 $banco = "database_test";
 $usuario = "root";
 $senha = "1234";
 $hostname = "localhost";
 $conn = mysql_connect($hostname,$usuario,$senha);
 mysql_select_db($banco) or die( "fail");
 if (!$conn) {echo "error"; exit;}
 else {echo "Sucess.";}
 mysql_close(); 
?>

I'm using ubuntu 12.10. In ubuntu 11.10, my zend framwrok application worked.

Upvotes: 1

Views: 3012

Answers (1)

Rachel Gallen
Rachel Gallen

Reputation: 28583

try this:

login as root and do

setsebool -P httpd_can_network_connect=1

it might be a permissions thing

Upvotes: 2

Related Questions