Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon does not see the MySQL PDO

Why is the error coming?

      could not find driver
      #0 [internal function]: PDO->__construct('mysql:host=loca...', 'root', 'pass', Array)
      #1 [internal function]: Phalcon\Db\Adapter\Pdo->connect(Array)
      #2 /var/www/domains/ovz1.vanixachatryan.zmy3z.vps.myjino.ru/app/Services.php(65): Phalcon\Db\Adapter\Pdo->__construct(Array)
      #3 [internal function]: Closure->{closure}()
      #4 [internal function]: Phalcon\Di\Service->resolve(NULL, Object(Phalcon\Di\FactoryDefault))
      #5 [internal function]: Phalcon\Di->get('db', NULL)
      #6 [internal function]: Phalcon\Di->getShared('db')
      #7 [internal function]: Phalcon\Mvc\Model\Manager->_getConnection(Object(Chat), NULL)
      #8 [internal function]: Phalcon\Mvc\Model\Manager->getReadConnection(Object(Chat))
      #9 [internal function]: Phalcon\Mvc\Model->getReadConnection()
      #10 [internal function]: Phalcon\Mvc\Model\MetaData\Strategy\Introspection->getMetaData(Object(Chat), Object(Phalcon\Di\FactoryDefault))
      #11 [internal function]: Phalcon\Mvc\Model\MetaData->_initialize(Object(Chat), 'chat-chat', 'chat', '')
      #12 [internal function]: Phalcon\Mvc\Model\MetaData->readMetaData(Object(Chat))
      #13 [internal function]: Phalcon\Mvc\Model\MetaData->hasAttribute(Object(Chat), 'id')
      #14 [internal function]: Phalcon\Mvc\Model\Query->_getQualified(Array)
      #15 [internal function]: Phalcon\Mvc\Model\Query->_getExpression(Array)
      #16 [internal function]: Phalcon\Mvc\Model\Query->_getOrderClause(Array)
      #17 [internal function]: Phalcon\Mvc\Model\Query->_prepareSelect()
      #18 [internal function]: Phalcon\Mvc\Model\Query->parse()
      #19 [internal function]: Phalcon\Mvc\Model\Query->execute()
      #20 /var/www/domains/ovz1.vanixachatryan.zmy3z.vps.myjino.ru/app/controllers/ControllerBase.php(16): Phalcon\Mvc\Model::find(Array)
      #21 /var/www/domains/ovz1.vanixachatryan.zmy3z.vps.myjino.ru/app/controllers/IndexController.php(7): ControllerBase->initialize()
      #22 [internal function]: IndexController->initialize()
      #23 [internal function]: Phalcon\Dispatcher->dispatch()
      #24 /var/www/domains/ovz1.vanixachatryan.zmy3z.vps.myjino.ru/public/index.php(22): Phalcon\Mvc\Application->handle(NULL)
      #25 {main}

List of installed modules: php71-php-pdo-7.1.19-1.el7.remi.x86_64

  php71-php-json-7.1.19-1.el7.remi.x86_64 
  php71-php-xml-7.1.19-1.el7.remi.x86_64 
  php71-php-phalcon3-3.4.0-1.el7.remi.x86_64 
  php-common-7.1.19-1.el7.remi.x86_64 
  php-mysqlnd-7.1.19-1.el7.remi.x86_64 
  php71-runtime-1.0-1.el7.remi.x86_64 
  php71-php-common-7.1.19-1.el7.remi.x86_64 
  php71-php-process-7.1.19-1.el7.remi.x86_64 
  php71-php-pear-1.10.5-5.el7.remi.noarch 
  php71-php-mbstring-7.1.19-1.el7.remi.x86_64 
  php-json-7.1.19-1.el7.remi.x86_64 
  php71-php-cli-7.1.19-1.el7.remi.x86_64 
  php71-1.0-1.el7.remi.x86_64 
  php71-php-fpm-7.1.19-1.el7.remi.x86_64 
edited Jun '18

Not Phalcon, PDO. This is pdo/php issue, not phalcon.



816

You could not tell how to install pdo_mysql on CentOS 7?

Not Phalcon, PDO. This is pdo/php issue, not phalcon.

edited Jun '18

Try yum install install php-pdo_mysqlmaybe. Not using centos really so can't help you.



816

but Package php-mysqlnd-7.1.19-1.el7.remi.x86_64 already installed and latest version . Why?

Try yum install install php-pdo_mysqlmaybe. Not using centos really so can't help you.

edited Jun '18

Better show what php -m returns. Maybe you don't have pdo_mysql loaded. You just have some kind of php/os issue, it's not phalcon issue anyhow.



816

[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_sqlite
phalcon
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zlib

Better show what php -m returns. Maybe you don't have pdo_mysql loaded. You just have some kind of php/os issue, it's not phalcon issue anyhow.



133.6k
Accepted
answer

As you can see you doesn't have pdo_mysql. You need to instlall it.