swoole / library

📚 Swoole Library
https://wiki.swoole.com/#/library
Apache License 2.0
237 stars 58 forks source link

help ~~ #56

Closed hexuan1922 closed 3 years ago

hexuan1922 commented 3 years ago

运行 php base.php 报如下错: PHP Fatal error: Uncaught PDOException: SQLSTATE[08006] [7] invalid connection option "charset" in @swoole-src/library/core/Database/PDOPool.php:44
Stack trace:

0 @swoole-src/library/core/Database/PDOPool.php(44): PDO->__construct('pgsql:host=xxxx...', 'xxx', 'xxxx', Array)

1 @swoole-src/library/core/Database/PDOProxy.php(41): Swoole\Database\PDOPool->Swoole\Database{closure}()

2 @swoole-src/library/core/ConnectionPool.php(89): Swoole\Database\PDOProxy->__construct(Object(Closure))

3 @swoole-src/library/core/ConnectionPool.php(58): Swoole\ConnectionPool->make()

4 /mnt/d/code/wwwroot/swool_library/examples/pdo/base.php(40): Swoole\ConnectionPool->get()

5 {main}

thrown in @swoole-src/library/core/Database/PDOPool.php on line 44

base.php 里 加上配置 ->withDriver('pgsql'), 注释掉 ->withCharset('utf8mb4')

PDOPool.php里 注释掉 -"charset={$this->config->getCharset()}" 仍报上边的错误...

php --ri swoole

swoole

Swoole => enabled Author => Swoole Team team@swoole.com Version => 4.4.19 Built => Sep 29 2020 15:54:47 coroutine => enabled epoll => enabled eventfd => enabled signalfd => enabled cpu_affinity => enabled spinlock => enabled rwlock => enabled pcre => enabled zlib => 1.2.7 mutex_timedlock => enabled pthread_barrier => enabled futex => enabled async_redis => enabled

Directive => Local Value => Master Value swoole.enable_coroutine => On => On swoole.enable_library => On => On swoole.enable_preemptive_scheduler => Off => Off swoole.display_errors => On => On swoole.use_shortname => On => On swoole.unixsock_buffer_size => 8388608 => 8388608

php -v
PHP 7.2.24 (cli) (built: Apr 19 2020 01:32:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

php -m | grep pdo
pdo_mysql
pdo_pgsql
pdo_sqlite

sy-records commented 3 years ago

不支持pgsql