1

When I ask the drush status while im in the folder of the website I get this message

/volume1/web/drupal8 $ drush status

PHP Fatal error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php on line 56

Fatal error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php on line 56 Drush command terminated abnormally due to an unrecoverable error.
[error] Error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php, line 56

When I ask the drush status while im in the bin folder drush seem to work

/bin$ drush status PHP configuration : /etc/php/php.ini PHP OS : Linux Drush script : /usr/local/bin/drush Drush version : 8.1.5 Drush temp directory : /tmp Drush configuration : Drush alias files :

I can't figure out what im doing wrong, how can I run drush on folder /volume1/web/drupal8?

thanks in advance

PDO is installed and enabled. I run php56 -i

PDO PDO support => enabled PDO drivers => dblib, mysql, pgsql, sqlite

pdo_dblib

PDO Driver for FreeTDS/Sybase DB-lib => enabled Flavour => freetds

pdo_mysql

PDO Driver for MySQL => enabled Client API version => mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd 41fc93cccd5bac2fe7a $

Directive => Local Value => Master Value pdo_mysql.default_socket => /run/mysqld/mysqld.sock => /run/mysqld/mysqld.sock

pdo_pgsql

PDO Driver for PostgreSQL => enabled PostgreSQL(libpq) Version => 9.3.6 Module version => 1.0.2 Revision => $Id: 0e858dd2051ca8c2fd3c781909a0670ab5fecd36 $ pdo_sqlite

PDO Driver for SQLite 3.x => enabled SQLite Library => 3.10.2

5
  • do you have PDO properly installed? Commented Sep 28, 2016 at 7:43
  • Is pdo installed? Run php -m to check. Commented Sep 28, 2016 at 7:44
  • Yes PDO is installed Commented Sep 28, 2016 at 8:02
  • I run $ php56 -m [PHP Modules] apc apcu bcmath bz2 calendar Core ctype curl date dba dom ereg exif fileinfo filter ftp gd gettext gmp hash iconv imap intl json libxml mbstring mcrypt mhash mysql mysqli mysqlnd openssl pcntl pcre PDO pdo_dblib pdo_mysql pdo_pgsql pdo_sqlite pgsql Phar posix readline Reflection session shmop SimpleXML soap sockets SPL sqlite3 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlrpc xmlwriter Zend OPcache zip zlib [Zend Modules] Zend OPcache Commented Sep 28, 2016 at 8:02
  • @Robert how do I know it's properly installed? Commented Sep 28, 2016 at 8:03

2 Answers 2

1

Probably, you don't have properly installed PDO_MYSQL. You need to invoke phpinfo() function and see if this module is present. The constant MYSQL_ATTR_SSL_CA comes from PDO library. If php is invoked from CLI then probably it has its own php.ini so you need to enable PDO there as well.

To check if you have enabled PDO in PHP CLI run php -m |grep PDO the command should return PDO string.

To install PDO check the PHP Manual for Installing PDO.

Sign up to request clarification or add additional context in comments.

5 Comments

I run /volume1/web/drupal8$ php56 -m | grep PDO PDO
I post de PDO in my question , PDO is enabled.
try to make simple script that connects to mysql via pdo, then change it to connect via SSL and see if it works
I checked permissions ls -la /volume1/@appstore and made symbolic links ln -s /usr/local/bin/composer /volume1/@appstore/composer ln -s /usr/local/bin/drush /volume1/@appstore/drush
I have an other problem now discribed here, will you please have a look stackoverflow.com/questions/39748604/…
1

I face this issue as well on all drupal 7 and 8 directory, while drush works fine outside drupal, it doesn't work in Drupal directory. the error says:

Error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in Drush\Sql\Sqlmysql->creds() (line 56 of phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php).

Installing php-mysql (or php5-mysql) fix the issue.

1 Comment

Please see this first how-to-answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.