getherbert / herbert

The WordPress Plugin Framework:
http://getherbert.com/
632 stars 94 forks source link

Building the plugins #116

Open maukul opened 8 years ago

maukul commented 8 years ago

WordPress 4.5.2 Building the plugins error Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'utf8' at line 1' in D:\work\xampp\htdocs\wordpress_test.loc\wp-content\plugins\herbert-dev\vendor\illuminate\database\Connectors\MySqlConnector.php:38 Stack trace: #0 D:\work\xampp\htdocs\wordpress_test.loc\wp-content\plugins\herbert-dev\vendor\illuminate\database\Connectors\MySqlConnector.php(38): PDO->prepare('utf8') #1 D:\work\xampp\htdocs\wordpress_test.loc\wp-content\plugins\herbert-dev\vendor\illuminate\database\Connectors\ConnectionFactory.php(61): Illuminate\Database\Connectors\MySqlConnector->connect(Array) #2 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors{closure}() #3 D:\work\xampp\htdocs\wordpress_test.loc\wp-content\plugins\herbert-dev\vendor\illuminate\database\Connection.php(898): call_user_func(Object( in D:\work\xampp\htdocs\wordpress_test.loc\wp-content\plugins\herbert-dev\vendor\illuminate\database\Connectors\MySqlConnector.php on line 38

jeremyzahner commented 8 years ago

Hi @maukul

Could you supply some more information on your system?

Like:

maukul commented 8 years ago
OS - Win 
PHP Version - PHP Version 5.6.15
MySQL Version - mysqlnd 5.0.11-dev

The problem was on wordpress "define('DB_CHARSET', 'utf8mb4'); " If remake herbert-dev\vendor\getherbert\framework\Herbert\Framework\Providers\HerbertServiceProvider.php As $capsule->addConnection([ ..... 'charset' => DB_CHARSET, ..... ]); it became $capsule->addConnection([ ..... 'charset' => 'utf8', ..... ]); it works

jeremyzahner commented 8 years ago

@jasonagnew Any thoughts on this? I guess we should find a way to make this work out of the box. In the official WP Docs (https://codex.wordpress.org/Editing_wp-config.php#Database_collation) they say that while the value of DB_COLLATE is not manually adjusted, it will stay empty.

Related:

https://github.com/getherbert/framework/issues/9