Setup ODBC for SQL Server in PHP 8 native Windows 11 - php

Fatal error: Uncaught Error: Call to undefined function odbc_connect() in C:\xampp\htdocs\simrs\tes.php:8 Stack trace: #0 {main} thrown in C:\xampp\htdocs\simrs\tes.php on line 8
I tried to write this
$server="myservername";
$username="myusername";
$password="mypassword";
$db="mydb";
$connection_string = "DRIVER={ODBC DRIVER 17 for SQL Server};SERVER=$server;PORT:myPort;DATABASE=$db";
$odbcConn = odbc_connect($connection_string,$username,$password); `
But that always fatal error.
I already installed ODBC driver. I don't actually know what caused this.

Related

Can't connect to odbc in php. could not find drivers

im trying to connect to a database on odbc with php and i get the error of
Fatal error: Uncaught PDOException: could not find driver in C:\xampp\htdocs\testarsybase\index.php:3 Stack trace: #0 C:\xampp\htdocs\testarsybase\index.php(3): PDO->__construct('odbc:host=192.1...', 'sa', '') #1 {main} thrown in C:\xampp\htdocs\testarsybase\index.php on line 3
im using the PDO('odbc (..)') to connect
What should i do?
See if this situation helps you. It seems to be the same question.
PDO returning error “could not find driver” with a known working DSN

connection to Oracle database in 64 bytes

I'm trying to connect to an Oracle database (11g XE) on my x64 machine. I have XAMPP with PHP 7.2 x86, but when running my script it shows me this error:
Fatal error: Uncaught Error: Call to undefined function oci_connect() in C:\xampp\htdocs\pruebaCustom\index.php:19 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pruebaCustom\index.php on line 19
In a 32-byte machine it works correctly but not in the 64-bit machine, so understanding the problem. Can someone tell me if I should do a different process?

Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() with XAMP and PHP 7

I'm trying to enable SQL Drivers.
I'm using xamp my version of php is 7.1.10 and Architecture x86
I installed the version 4 of SQL Drivers, and moved the files to the extesions folder and I have this in the php.ini
extesion=php_sqlsrv_7_nts_x86.dll
extesion=php_pdo_sqlsrv_7_nts_x86.dll
And I'm getting this error
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in
C:\xampp\htdocs\diplomado\conection.php:4 Stack trace: #0
C:\xampp\htdocs\diplomado\index.php(17): include() #1 {main} thrown in
C:\xampp\htdocs\diplomado\conection.php on line 4
and this is my php file
$serverName= "localhost";
$conectionInfo = array("DataBase"=>"prueba","UID"=>"Root", "UPW"=>"");
$con = sqlsrv_connect($servername,$conectionInfo);
if ($con){
echo "Succesful";
}else{
echo "failed";
}
?>

I am trying to do a simple connection with XAMPP and sql server

When ever I try to enter data or connect to the database, I get this error
Fatal error: Uncaught Error: Call to undefined function
mysql_pconnect() in C:\xampp\htdocs\smstrail\admin\lib\dbcon.php:8
Stack trace: #0 C:\xampp\htdocs\smstrail\header.php(2): dbcon() #1
C:\xampp\htdocs\smstrail\index.php(2): include('C:\xampp\htdocs...')
2 {main} thrown in C:\xampp\htdocs\smstrail\admin\lib\dbcon.php on line 8
Example of line 8:
#mysql_pconnect($host,$user,$pass);
The function mysql_pconnect is deprecated in PHP 5.5.0. You should either use
mysqli_connect or make a connection using PDO. Check out the documentation for more info : http://php.net/manual/en/function.mysql-pconnect.php

PDO : Uncaught PDOException: could not find driver

I'm using odbc and XAMPP. I'm receiving the fatal error of could not find driver
Fatal error: Uncaught PDOException: could not find driver in C:\xampp\htdocs\index.php:5 Stack trace: #0 C:\xampp\htdocs\index.php(5): PDO->__construct('odbc:BEGIN') #1 {main} thrown in C:\xampp\htdocs\index.php on line 5
This is the code the error refering to :
$conn = new PDO ("odbc:BEGIN");
Is there any module that I should add to the php.ini like this answer or there are other solution?
You need to enable those extensions in order to have ODBC PDO driver working
php_pdo.dll
php_odbc.dll
php_pdo_odbc.dll
After enabling those extension as #Sarhan said, we need to restart Apache in order for it to work.

Categories