Ich erhalte Caught exception: could not find driver
in meinemgU Erweiterungen nicht
function connect_to_server()
{
$serverName = DB_HOST;
$this->_connection = new PDO("odbc:Driver={SQL Server};Server=$serverName,1433; Database=".DB_NAME.";",DB_USER,DB_PASS);
// $this->_connection = new PDO("sqlsrv:Server=192.168.1.97;Server=$serverName,1433; Database=".DB_NAME.";",DB_USER,DB_PASS);
if(!$this->_connection)
{
die(print_r(sqlsrv_errors(), true));
}
else
{
return $this->_connection;
}
}
gefunden Wenn ich es in Try-Catch haben wie
try {
$this->_con = $this->connect_to_server() . "\n";
} catch (PDOException $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
Also habe ich den Treiber von here ich bin in Schritt yum -y install php-pecl-memcache
installieren wollte, wenn Ich laufe in Befehl ich bekomme
Error: php71w-common conflicts with php-common-5.4.16-42.el7.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Also habe ich versucht Finden Sie eine Lösung für diese und gefunden this Also ich yum install php70w-mysqli
ausführen, aber es wurde der gleiche Fehler zurückgegeben.
What is the correct way to install these drivers.
Das kann ich in meinem lokalen laufen, weil ich diese haben:
extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
Aber in meinem Server Ich habe nicht diese in der php.ini.
Ich habe nur dieses
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
; extension=msql.so
;
; ... or with a path:
;
; extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
UPDATE
yum -y install php_odbc
mit versucht, aber bekam
Loaded plugins: fastestmirror
Repository packages-microsoft-com-prod is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirror.pregi.net
* epel: mirror.pregi.net
* extras: mirror.pregi.net
* updates: mirror.pregi.net
* webtatic: sp.repo.webtatic.com
No package php_odbc available.
Error: Nothing to do
Wher i laufen: php -i | grep PDO
ich:
PDO
PDO support => enabled
PDO drivers => mysql, sqlite
PDO Driver for MySQL => enabled
PDO Driver for SQLite 3.x => enabled
Haben Sie versucht, Apache oder PHP-FPM neu zu starten? –
ja mit 'systemctl Neustart httpd.service' in localhost benutze ich Windows OS im Server ist es CentOS7. in 'php -i | grep PDO' sollte es 'odbc' rechts haben ?? @LawrenceCherone – Martin