Quantcast

ZF2, Create database connection to php cloud db server

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

ZF2, Create database connection to php cloud db server

Chintan Patel
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hello,
I'm first time using phpcloud with ZF2 stable.

How do i change config/autoload/global.php file for using with phpcloud ?

I'm using following code. But It's not working.
return array(
    'db' => array(
        'driver' => 'Pdo',
        'dsn'            => 'mysql:dbname=chintan;hostname=chintan-db.my.phpcloud.com',
        'username'       => 'chintan',
        'password'       => '',
        'port'           => '3306',
        'driver_options' => array(
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
        ),
    ),
    'service_manager' => array(
        'factories' => array(
            'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
        ),
    ),
);

Thanks,
Chintan V. Patel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2, Create database connection to php cloud db server

samsonasik
This post has NOT been accepted by the mailing list yet.
have you set your host firewall ? I think you should check with mysql_connect() command first.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF2, Create database connection to php cloud db server

Chintan Patel
This post has NOT been accepted by the mailing list yet.
This post was updated on .
But my code & db is on live (phpcloud). How does firewall matter in this case ?

EDIT:
Solved by
 'dsn'            => 'mysql:dbname=chintan;hostname=chintan-db.my.phpcloud.com',
to
 'dsn'            => 'mysql:dbname=chintan;host=chintan-db.my.phpcloud.com',
Loading...