How to connect php7 to oracle 11g

王林
Release: 2023-02-27 08:08:01
Original
4095 people have browsed it

How to connect php7 to oracle 11g

1. Unzip the client and put it in a directory, create a new tnsnames.ora and put it in the subdirectory of the client folder

How to connect php7 to oracle 11g

2. Add the following code: est_db is the connection name you gave yourself, replace the IP with the IP of the remote oracle, and put the database name in service_name

How to connect php7 to oracle 11g

3. Enable the oci extension of php Or pdo_oci extension, connection test

Because php7 does not have the extension of php_oci_11g, you need to install it yourself, download the corresponding version of the dll file, put it in the ext directory of php, and enable the extension in php.ini

After opening, windows may be missing the oci.dll file

How to connect php7 to oracle 11g

4. Copy the oci.dll file in the client above to the PHP directory. --》Start php, check PHPinfo and the following extension should appear

How to connect php7 to oracle 11g

5. Test the code to connect to the database

How to connect php7 to oracle 11g

6. PDO mode will throw the following exception (SQLSTATE[]: pdo_oci_handle_factory: > (ext\pdo_oci\oci_driver.c:642))

If you copy just now If you delete the files in the php directory, some of them will definitely not be deleted if they are used. After testing, only the following file and the oci.dll file just now cannot be deleted

How to connect php7 to oracle 11g

##7 , Now you’re done, test the above PHP code here:

How to connect php7 to oracle 11g

Recommended tutorial:

PHP video tutorial

The above is the detailed content of How to connect php7 to oracle 11g. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template