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
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
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
4. Copy the oci.dll file in the client above to the PHP directory. --》Start php, check PHPinfo and the following extension should appear
5. Test the code to connect to the database
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
##7 , Now you’re done, test the above PHP code here: Recommended 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!