PDOException in connecting online database


I’ve registered a free online host and imported the tables from localhost database, then the PDOException happened after login. The application is working fine with localhost database. I don’t know if the problem comes from the user table, it is the default user model and created by yii migrate.



How can I config it? Thanks for your help!

You server doesn’t have PDO PHP ( php_pdo) extension installed. Please check that.

As the error message suggests, you should look at yii\db\Connection.php line 646.

It’s probably in the createPdoInstance() method:

If your server does have php_pdo installed, you might need to adjust $this->dsn, $this->username and $this->password according to your production environment. Check your config/db.php.


I’ve tried to use another free host and got the same error.

I’ve also tried to create a new project to do yii migrate and still got the same error :(



Did you check the php_pdo extension? Did you check the dsn, username and password?

I don’t think you can locally run migration for a shared host via the network.

I’ve check the dsn, username and password, they’re ok.

Can I access online database from my localhost application? If cannot, I think the problem is here

I’m afraid you can’t.