connecting php to oracle 19c db - php

Trying to connect to oracle 19c from php the server is not on the same machine as the php, I have so far installed instant client 19_15, added it as a environment variable, and then in the php.ini file I have taken off the semi colon for both the files extension=oci8_19 and extension=pdo_oci not sure what else to do to make the php to connect to the oracle db.
some error messages I have been getting are: PDO: connection failed: could not find driver
and from oci_connect: Fatal error: Uncaught Error: Call to undefined function oci_connect() in Stack trace: #0 {main} thrown in on line 7
p.s. architecture is x64, php version is 8.1.8 and using apache24 lounge

Related

PHP PDOException: could not find driver but driver is installed?

I'm running PHP 7.1 on an IIS 10.0 server and trying to connect to a MSSQL database.
Trying to instantiate a connection like this:
$dbh = new PDO("sqlsrv:Server=#server#;Database=#dbname#", "#username#", "#passwd#");
Gives me this error:
Fatal error: Uncaught PDOException: could not find driver in C:\inetpub\wwwroot\projects\test.php:6 Stack trace: #0 C:\inetpub\wwwroot\projects\test.php(6): PDO->__construct('sqlsrv:Server=...', '#username', '#pwd...') #1 {main} thrown in C:\inetpub\wwwroot\projects\test.php on line 6
However, sqlsrv is activated in my php.ini:
extension=php_sqlsrv.dll
extension=php_pdo_sqlsrv.dll
It's uncommented, and it's the right php.ini (already checked with phpinfo()). Restarting the server also didn't do anything.
I really don't understand why this is happening when the driver is obviously installed :/
What makes it extra weird is that I have another application running on the same server that also connects to a MSSQL database and it works with no problems, it had an automatic installer though so I didn't have to configure anything myself. It also connects to a local db and right now I'm trying to connect to a remote one if that makes a difference.

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?

Connect to Foxpro with PHP using OLE DB driver

I'm trying to connect to a Foxpro database using the OLE DB Driver
I downloaded the driver from http://www.microsoft.com/en-us/download/details.aspx?id=14839 and installed it then create a php script
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("Provider=vfpoledb.1;Data Source=C:\Opera3\Comp_I.DBC;Collating Sequence=machine");
This gives me the following error
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> ADODB.Connection<br/><b>Description:</b> Provider cannot be found. It may not be properly installed.' in C:\inetpub\wwwroot\test1.php:4 Stack trace: #0 C:\inetpub\wwwroot\test1.php(4): com->Open('Provider=vfpole...') #1 {main} thrown in C:\inetpub\wwwroot\test1.php on line 4
Any help in getting this working would be much appreciated.
As requested
uninstalled and reinstalled from command line as administrator for all users and now it works –

Question about PHP PDO INFORMIX ERROR

I have installed PDO_INFORMIX and CSDK already on CentOS5.6 32bits
and index.php have
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$db = new PDO("informix:host=172.30.179.81; service=5000;database=cms; EnableScrollableCursors=1", "myuser", "mypassword");
print("OK");
?>
but i still got this error
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE=HY000, SQLDriverConnect: -11060 [Informix][Informix ODBC Driver]General error.' in /usr/local/apache/htdocs/index3.php:5 Stack trace: #0 /usr/local/apache/htdocs/index3.php(5): PDO->__construct('informix:host=1...', 'myuser', 'mypassword') #1 {main} thrown in /usr/local/apache/htdocs/index3.php on line 5
Have anyone know what it is ?
Thanks
Ouch! The standard technique for finding out more about errors is:
$ finderr -11060
-11060 General error.
An error occurred that has no specific SQL_STATE. In this case,
additional text is provided that identifies the source of the problem.
This IBM Informix CLI error code is the same as SQLSTATE value S1000.
$
That is not very helpful - to be polite about it.
There are spaces in the connect string; does removing them help at all?
Can you telnet to the host 172.30.179.81?
Can you telnet to the port (service) 5000 on the host?
Can you connect from this machine using any other Informix tool?
Can you connect from other machines using the same connect string?
In case of desparation, can you track down whether all the shared libraries are loading correctly?

PHP Connection to MS SQLServer 2008 from Linux via PDO

I need to connect to a MS SQLServer 2008 service from PHP on Ubuntu, and I would like to do so using PDO. I believe I have installed all the prerequisite libraries, and I am indeed able to connect using tsql on the command line and using mssql_connect() in code. I can't figure out what the proper DSN is, or if there are any additional PDO-specific configuration steps I am missing.
I am using the following DSN (where $db* variables are populated with their appropriate values):
odbc:Driver=FreeTDS;SERVER=$dbServer;DATABASE=$dbSchema;UID=$dbUser;PWD=$dbPasswd"
My error message is:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified' in /home/timothy/test.php:4
Stack trace:
#0 /home/timothy/test.php(4): PDO->__construct('odbc:Driver=Fre...')
#1 {main}
thrown in /home/timothy/test.php on line 4
What additional configuration steps have I over looked?
Thanks in advance.
You shouldn't need any additional configuration if you can connect with tsql and the mssql extension. You probably just don't have the correct dsn. This documentation should help. Try new PDO("dblib:host=xx.xx.xx.xx;dbname=mydatabase", "username", "password");

Categories