Неустранимая ошибка: объявление CakeDC\OracleDriver\Database\OCI8\OCI8Connection: :query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null) должен быть совместим с PDO::query(string $query, ?int $fetchMode = null, смешанный ...$fetchModeArgs): PDOStatement|false в E:\my-cake-project\vendor\cakedc\cakephp-oracle-driver\src\Database\OCI8\OCI8Connection.php в строке 130
Я включил все необходимые расширения (php.ini) и драйвер oracle в моем проекте в соответствии с документацией, представленной в репозитории github, который я использовал.
мой файл php.ini выглядит так это: (включено расширение)
Код: Выделить всё
extension=curl
;extension=ffi
;extension=ftp
extension=fileinfo
;extension=gd
extension=gettext
;extension=gmp
extension=intl
;extension=imap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
extension=oci8_19 ; Use with Oracle Database 19 Instant Client
;extension=odbc
;extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
; The MIBS data available in the PHP distribution must be installed.
; See https://www.php.net/manual/en/snmp.installation.php
;extension=snmp
;extension=soap
;extension=sockets
;extension=sodium
extension=sqlite3
;extension=tidy
;extension=xsl
extension=zip
Код: Выделить всё
public function bootstrap(): void
{
// Call parent to load bootstrap from files.
parent::bootstrap();
if (PHP_SAPI === 'cli') {
$this->bootstrapCli();
} else {
FactoryLocator::add(
'Table',
(new TableLocator())->allowFallbackClass(false)
);
}
/*
* Only try to load DebugKit in development mode
* Debug Kit should not be installed on a production system
*/
if (Configure::read('debug')) {
$this->addPlugin('DebugKit');
}
// Added oracle driver plugin
$this->addPlugin(\CakeDC\OracleDriver\Plugin::class, ['bootstrap' => true]);
}
protected function bootstrapCli(): void
{
$this->addOptionalPlugin('Cake/Repl');
$this->addOptionalPlugin('Bake');
$this->addPlugin('Migrations');
// Added oracle driver plugin
$this->addPlugin(\CakeDC\OracleDriver\Plugin::class, ['bootstrap' => true]);
}
Код: Выделить всё
'Datasources' => [
/*
* These configurations should contain permanent settings used
* by all environments.
*
* The values in app_local.php will override any values set here
* and should be used for local and per-environment configurations.
*
* Environment variable based configurations can be loaded here or
* in app_local.php depending on the applications needs.
*/
'default' => [
'className' => 'CakeDC\OracleDriver\Database\OracleConnection',
'driver' => 'CakeDC\OracleDriver\Database\Driver\OracleOCI', # For OCI8
// 'driver' => 'CakeDC\\OracleDriver\\Database\\Driver\\OraclePDO', # For PDO_OCI
'persistent' => true, // Database persistent connection between http requests
'host' => 'oracle.xyz.com', // Database host name or IP address
'port' => 1111, // Database port number (default: 1521)
'username' => 'myoracle', // Database username
'password' => 'xxxxxxxxxx', // Database password
'database' => 'myoracle_db', // Database name (maps to Oracle's `SERVICE_NAME`)
'sid' => 'ORCL', // Database System ID (maps to Oracle's `SID`)
'instance' => '', // Database instance name (maps to Oracle's `INSTANCE_NAME`)
'pooled' => '', // Database pooling (maps to Oracle's `SERVER=POOLED`)
'flags' => [], // Database low level parameters for OCI or PDO connection. Auto-generated by default
'encoding' => '', // Database charset (default same as database charset)
'init' => [], // Array of queries executed at connection
'cacheMetadata' => true, // Enable cakephp schema caching
'server_version' => 19, // Oracle server numeric version ex.: 11,12,19
'autoincrement' => true, // Enable autoincrement insteadof custom triggers in case of oracle 12+
],
Моя среда:
Код: Выделить всё
> PHP 8.2.7
> CakePHP 4.4.14 Strawberry
> Oracle Database 19.3
> Oracle Client 19.19
> Windows Platform
Подробнее здесь: https://stackoverflow.com/questions/765 ... nnectionqu