• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 644
  • Last Modified:

can't connect to db host from zend_db

using zend_db via config.ini to try to connect to a remote host. i can connect fine with command line (mysql -h 209.x.x.x -u username -p), but using the same settings in zend_db from the same server i get the following error. the same exact code works perfect on the server machine.
Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on '209.x.x.x' (13)' in

Open in new window

0
smueller72
Asked:
smueller72
  • 4
1 Solution
 
smueller72Author Commented:
just to rephrase this, i am using zend framework mvc and zend_db to connect to a database. the same code works perfectly on production server, but not on a remote development box. this would lead me to believe that there is a problem with privileges/hosts or a firewall issue, but from the remote box i can connect fine to it with the same login info. i am receiving this error on the page i am trying to connect it to.


Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on '209.x.x.x' (13)' in /home/domain/public_html/library/Zend/Db/Adapter/Pdo/Abstract.php:143
0
 
smueller72Author Commented:
fyi, this isn't zend specific. i am also using a joomla app, and cannot connect to the db server through php -- but i can through the mysql command line.
0
 
Richard QuadlingSenior Software DeverloperCommented:
Can you check the version of the mysql libraries you are using.

Create a file called info.php containing ...

<?php
phpinfo();
?>


Save this on both servers and then load them via your browser and see what is different.


0
 
smueller72Author Commented:
here is the phpinfo
http://www.mtszone.com/phpinfo.php

Client API version       5.0.79

here is the older server that works fine...
http://butterbean.marathontechservices.com/phpinfo.php

same code, centos5, etc. just an updated mysql library.
0
 
smueller72Author Commented:
its another darn selinux problem
http://www.ehow.com/how_2090983_connect-remote-database-under-selinux.html

this command fixed it:
setsebool -P httpd_can_network_connect=1

i had a few problems with the newest version of centos. please be aware centos comes with a lot of restrictive apache/selinux permissions which need to be tweaked to open them up.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now