简体   繁体   中英

zf2 apps unable to connect to mysql database hosted in dreamhost server

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\''
       ),
    ),

Need a lot more information to debug this but off the top of my head here are some issues I see: First, ensure your dbname is the same on your production as in your local. Providers sometimes use a prefix. Second, keep the DSN on one line. It's a rare and specific bug but it happens. Third, make sure you pushed all the files necessary AND created local files on each environment. Deployments usually ignore local files, so your *.local.php files may have never made it up.

Hope this helps point you in the right direction

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM