[root@portalgtm pdo_oci]# php -v
PHP 7.4.11 (cli) (built: Sep 29 2020 10:17:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies
[root@portalgtm pdo_oci]# php -i | grep oci
/etc/php.d/oci8.ini,
/etc/php.d/pdo_oci.ini
oci8
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
PDO drivers => mysql, odbc, pgsql, sqlite, oci
PWD => /home/install-11/php-7.4.11/ext/pdo_oci
$_SERVER['PWD'] => /home/install-11/php-7.4.11/ext/pdo_oci
Подключение к базе
<?php
$tns = " (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = IP адрес)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SID)
)
)
";
$db_username = "login";
$db_password = "passwd";
//$;
try{
$conn = new PDO("oci:dbname=" . $tns . ";charset=utf8",$db_username,$db_password,);
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
}catch(PDOException $e){
echo ($e->getMessage());
}
?>
При подключении выходит ошибка could not find driver.
<img src="https://habrastorage.org/webt/65/32/26/653226d61056a278043331.png" alt="image"/>
<img src="https://habrastorage.org/webt/65/32/26/653226dc1c380105574768.png" alt="image"/>
Сервер видит библиотеки оракла но в phpinfo нет.