Zend framework application unable to connect to database

software development

#1

i’m a beginner in PHP and Zend Framework 2,

i’ve develop small apps using ZF2. its working well in my local. so i try to publish on the net (www.khairatbtho.ipt4u.com - hosted at dreamhost). it can show the first page… actually its the zend sceleton welcome page.

but when i want to go to the next page (profile) where i need to access the database, it give this error

" An exception was raised while creating “Profile\Model\ProfileTable”; no instance returned "

I assume the problem with my database setup but i’m sure i’ve set it right… may be i missing something here… glad if any of you could help

this is my global.php setting

    'db' => array (
       'driver'        => 'Pdo',
       'dsn'           => 'mysql:dbname=khairatbtho; 
                           host=mysql.khairatbtho.ipt4u.com',
       'username'      => 'btho',
       'password'      => 'btho43200',
       'driver_options'=> array(
           PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
       ),
    ),

#2

You might want to visit the mySQL databases page in the panel, click the user name listed above and change the password, since it’s posted above. Best way to do that is change the text of the password to REMOVED when you paste code into the forum.

Sorry I have to pass helping with your question, my answer would be shakey… pretty sure I know the answer, but I’ll leave it for someone with more fact than I have =]


#3

LakeRat… the page, username and password is temporary … hoping very much someone out there could help me. If you know the answer and its working… it is good enough for me. Your kind help is very much appreciated.


#4

Have you created the table for your Profile model in the database on DreamHost? The error message sounds like it might not exist yet.


#5

Thanks Andrew, i already create all the table… in fact my last test i’m able to connect to my database hosted in dreamhost from my local (i runs the apps from my local server but point the database to dreamhost server)… so this confirm my setting is correct and my database is up and running…

but i still cannot get the apps which hosted in dreamhost server to connect to the same database …

i suspect the setting for mysql database user in dreamhost under ‘Allowable Host’ … i cannot get it right here…

current setting for ‘Allowable Host’ is as follows

%.dreamhost.com /* this is by default created by dreamhost /
%.khairatbtho.ipt4u.com /
i’ve try to add this two line but still not working /
%.khairatbtho.ipt4u.com%
2xx.1xx.7x.x /
this is for my local server */

…your help very much appreciated


#6

it turns out the problem is not with my database setting but it was my service manager… thanks guys