1

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.

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
user1657394
  • 299
  • 1
  • 4
  • 5

1 Answers1

2

try this:

login as root and do

setsebool -P httpd_can_network_connect=1

it might be a permissions thing

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
  • I already tried that, but when I run the command, I get $setsebool -P httpd_can_network_connect=1 Cannot set persistent booleans, please try as root. Could not change policy booleans rudy@rudy-pc:~$ sudo setsebool -P httpd_can_network_connect=1 libsemanage.dbase_llist_set: record not found in the database (No such file or directory). libsemanage.dbase_llist_set: could not set record value (No such file or directory). Could not change boolean httpd_can_network_connect Could not change policy booleans – user1657394 Apr 10 '13 at 00:52
  • then refer to this documentation for further steps, it involves adding a registry key and rebooting http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html – Rachel Gallen Apr 10 '13 at 00:55
  • otherwise see http://stackoverflow.com/questions/1420839/cant-connect-to-mysql-server-error-111 – Rachel Gallen Apr 10 '13 at 00:58