PHP connects to Oracle database under Win7 64-bit system, win7oracle_PHP tutorial

WBOY
Release: 2016-07-13 10:20:32
Original
865 people have browsed it

PHP connects to Oracle database under Win7 64-bit system, win7oracle

Let’s talk about the configuration process

1. Download oracle instantclient

Download address: http://www.oracle.com/technetwork/topics/winx64soft-089540.html

Download instantclient-basic-windows.x64-11.2.0.4.0

Extraction path: D:Program Files (x86)Oracle64Clientinstantclient_11_2

*Note: The client needs to correspond to the database version.

2. Configure system environment variables

Add after the PATH environment variable: ;D:Program Files (x86)Oracle64Clientinstantclient_11_2

3. Configure PHP to support OCI extension

Modify the configuration file php.ini

Enable the configuration as follows

4. Restart the Apache service test

Use the probe function phpinfo() to check whether the extension is enabled. If the following picture appears, it means the extension is enabled

5. Test database connection

Write oracle.php in the root directory of the site. I am connecting to the Oralce database in the virtual machine CentOS

The code is as follows:

<&#63;php
  $conn = ocilogon('test','test','192.168.23.131:1521/dev');
  if (!$conn)
  {
    $Error = oci_error();
    print htmlentities($Error['message']);
    exit;
  }
  else
  {
    echo "Connected Oracle Successd!"."<br>";
    ocilogoff($conn);
  }
&#63;>
Copy after login

Enter http://localhost/oracle.php in the browser address bar

Display Connected Oracle Successd! indicates that the database connection is successful.

WIN7 64-bit problem connecting to ORACLE database

I encountered it and solved it.
The server of my unit is configured with CENTOS 5.5 At first I also asked if I had to change the operating system to 32-bit.
After testing later, I found that the reason was very simple, because it was installed in the Program Files (X86) folder of the C drive. This folder is very special. It is to improve 64-bit compatibility and make it compatible with 32-bit mode folders. Generally, 32-bit software is installed here by default and will run in 32-bit, so it will cause toad and PL/SQL to fail. connect.
So the solution is very simple. Just install PL/SQL and TOAD on the D drive and you can connect.

Win7 64-bit operating system, how to connect plsql to oracle database?

Solution to using PLSQL+Developer+ under win7+64 bits+Oracle+11g+64 bits

1) Install Oracle 11g 64 bits (I won’t go into this part)
2) Installation 32-bit Oracle client (instantclient-basic-win32-11.2.0.1.0)
Download instantclient-basic-win32-11.2.0.1.0.zip (must be 32-bit, don’t download the wrong version, Download it from Oracle's official website), unzip it to Product under the Oracle installation directory (this machine is named: instantclient_11_2): D:\Oracle\app\dd\product\instantclient_11_2.
Copy a directory D:\Oracle\app\dd\product\11.2.0\dbhome_1\NETWORK under the database installation root directory to the Oracle client directory D:\Oracle\app\dd\product\instantclient_11_2 (actually Only NETWORK\ADMIN\tnsnames.ora is required)
3) Install PL/SQL Developer
Install PL/SQL Developer, set OCI Library and Oracle_Home in preference->Connection, for example, the local setting is:
Oracle Home: D:\Oracle\app\dd\product\instantclient_11_2
OCI Library: D:\Oracle\app\dd\product\instantclient_11_2\oci.dll
4) Set environment variables (modify environment variables )
For the NLS_LANG environment variable, it is best to set it consistent with the database side. First query the character set information from the database side:
SQL> select userenv('language') nls_lang from dual;
NLS_LANG
-------------------------------------------------- --
SIMPLIFIED CHINESE_CHINA.ZHS16GBK
Right-click "My Computer" - "Properties" - "Advanced" - "Environment Variables" - "System Environment Variables":
1>. Click "New", Set the variable name to "NLS_LANG", set the variable value to "SIMPLIFIED CHINESE_CHINA.ZHS16GBK", click "OK";
2>. Create a new environment variable "TNS_ADMIN" with the value "D:\Oracle\app\dd\product \instantclient_11_2”
Finally click "OK" to exit.

Start PL/SQL Developer and run without problems. ...The rest of the text>>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/866669.htmlTechArticle PHP connects to Oracle database under Win7 64-bit system, win7oracle. Let’s talk about the configuration process 1. Download oracle instantclient download address: http://www.oracle.com/technetwork/topics/winx64sof...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!