The project encountered a problem, that is, how to connect to Oracle for development in Windows. Almost all examples are based on Mysql, and Oracle connection itself is complicated on Windows. Here is a short story
The project encountered a problem, that is, how to connect to Oracle for development in Windows. Almost all examples are based on Mysql, and Oracle connection itself is complicated on Windows. Here is a short story
The following describes the configuration process.
1. Download oracle instantclient
:
Download instantclient-basic-windows.x64-11.2.0.4.0
Decompress path: D: \ Program Files (x86) \ Oracle64Client \ instantclient_11_2
* Note: The client must have the corresponding database version.
2. configure system environment variables
Add:; D: \ Program Files (x86) \ Oracle64Client \ instantclient_11_2 to the path environment variable.
3. Configure PHP to support OCI Extension
Modify the configuration file php. ini
The configuration is as follows:
4. Restart the Apache service for testing
Use the probe function phpinfo () to check whether the extension is enabled. If so, the extension is enabled.
V. Test Database Connection
Write oracle. php In the root directory of the site. I am connected to the Oralce database in the CentOS virtual machine.
The Code is as follows:
<? Php $ conn = ocilogon ('test', 'test', '192. 168.23.131: 192/dev'); if (! $ Conn) {$ Error = oci_error (); print htmlentities ($ Error ['message']); exit;} else {echo "Connected Oracle Successd! "."
"; Ocilogoff ($ conn) ;}?>
Enter the address bar of the browser
Show Connected Oracle Successd! The database is successfully connected.
,