0

A cronjob keeps raising this issue

Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'

the cronjob:

php /path/to/public/index.php /cron

My server: PHP Version 5.6.23 (Apache Handler) Ubuntu 14.04

The line provoking the error is FatFreeFramework's SQL php class:

function __construct($dsn,$user=NULL,$pw=NULL,array $options=NULL) {
    $fw=\Base::instance();
    $this->uuid=$fw->hash($this->dsn=$dsn);
    if (preg_match('/^.+?(?:dbname|database)=(.+?)(?=;|$)/is',$dsn,$parts))
        $this->dbname=$parts[1];
    if (!$options)
        $options=array();
    if (isset($parts[0]) && strstr($parts[0],':',TRUE)=='mysql')
        $options+=array(\PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES '.
            strtolower(str_replace('-','',$fw->get('ENCODING'))).';');
    $this->pdo=new \PDO($dsn,$user,$pw,$options);
    $this->engine=$this->pdo->getattribute(\PDO::ATTR_DRIVER_NAME);
}

After reading Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in Undefined class constant (PHP 5.5.3) I've tried adding the extensions in the php.ini, to no avail.

 extension=pdo.so
 extension=pdo_mysql.so

This SO post seems to indicate that the constant is not necessary but the thread was never closed. Advises welcome.

Community
  • 1
  • 1
pixeline
  • 17,669
  • 12
  • 84
  • 109

0 Answers0