Hello I am a newbie in PHP and Oracle and I have to connect PHP to Oracle database on two different machines.
Here is my code:
<?php
$servername = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=aaa.bbb.ccc)
(PORT=1632))(CONNECT_DATA=(SERVER=dedicated)(SERVICE_NAME=int)))";
$conn = oci_connect("aaa", "bbb", $servername);
if (!$conn) {
$m = oci_error();
echo $m['message'], "\n";
exit;
}
else {
print "Connected to Oracle!";
}
// Close the Oracle connection
oci_close($conn);
?>
The error that i get is: Fatal error: Uncaught Error: Call to undefined function oci_connect() in C:\xampp\htdocs\php-e\serial.php:4 Stack trace: #0 {main} thrown in C:\xampp\htdocs\php-efactura\serial.php on line 4
I have read online that I have to decomment the extension=oci8_12c ; Use with Oracle Database 12c Instant Client which I did and install Oracle Instant Client 12 32 bit and add it to the path of the environment variables which I did. I even restarted the PC and it still gives me the same error. Do you have any ideea why id doesn`t work ? I am working from XAMPP.
Thanks in advance
Related
Trying to connect php to oracle 19c, using php 8.1, apache lounge, this is the code i am trying to run
// Create connection
$conn = oci_connect($username, $password, $servername);
// Check connection
if (!$conn) {
$e = oci_error();
echo htmlentities($e["message"]);
}
error message: Warning: oci_connect(): ORA-12637: Packet receive failed
I have download and set the enviroment variable of both the latest oracle instant client and the version 19_15. But still getting the same error message have also uncommented the dll files oci8_19 and pdo_oci.
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
I imported the proper mongodb.dll file in php/ext and also configured php.ini but it seems that I can't connect to mongodb via my php code. Example
<?php
// connect to mongodb
$m = new MongoClient();
echo "Connection to database successfully";
// select a database
?>
Fatal error: Uncaught Error: Class 'MongoClient' not found in C:\xampp\htdocs\date\include\db2.php:3 Stack trace: #0 {main} thrown in C:\xampp\htdocs\date\include\db2.php on line 3
i have big problem while connection to a remote informix database server.
here's the code
$db = new PDO("informix:host=192.168.*.*; service=1565;
database=daten; server=name; protocol=onsoctcp;
EnableScrollableCursors=1", "informix", "info00");
print "Connection Established!\n\n";
echo "Table contents: $rows.\n";
I receive the following error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE=HY000, SQLDriverConnect: -917 [Informix][Informix ODBC Driver][Informix]Must close current database before using a new database.' in /var/www/informix.php:9 Stack trace: #0 /var/www/informix.php(9): PDO->__construct('informix:host=1...', 'informix', 'info00') #1 {main} thrown in /var/www/informix.php on line 9
How can I fix this?
I think you should also set the DB_LOCALE environment variable.
When the client application requests a connection, it sends information, including the DB_LOCALE to the database server.
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?