K
K
Ken Jee2016-11-13 14:03:59
PHP
Ken Jee, 2016-11-13 14:03:59

How to fix Class PDO not found error in Yii2 on Ru-Center hosting?

Regular hosting at Ru-Center. PHP 7.
PDO and PDO_MYSQL extensions included.
Framework Yii2.
When trying to migrate...
php yii migrate
...the following error occurs:

PHP Fatal Error 'yii\base\ErrorException' with message 'Class 'PDO' not found'

da258713e3b542588108f1fc92e61016.jpg
I contacted the host. I was advised to run the following command:
php -c ~/etc/php.ini /home/[host_user]/[domain_foder]/yii migrate

But the result of this command is the following error:
Exception 'yii\db\Exception' with message 'SQLSTATE[HY000] [2002] No such file or directory'

44f08bcf537f4c9ba13da07187ccbff1.jpg
The command...
php -i | grep pdo
...doesn't output anything, but in php.ini pdo.so and pdo_mysql.so are both present and uncommented.
Tell me which way to think...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Ken Jee, 2016-11-13
@Machez

On hosting at RU-Center, the MySql server host looks like this: user.mysql , not localhost

M
Maxim Timofeev, 2016-11-13
@webinar

error in the absence of PDO. Enable mysql_pdo in the settings, if you use mysql,
theoretically it can be connected for web PDO, but not for the console, a separate config
Didn’t work with the console on Ru-Center, but in shared hosting PDO was initially disabled, but it turns on in 2 clicks, you have apparently a dedicated server, I won’t point a finger for sure, but I need to find where to turn it on

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question