phpStudy configuration sql, oracle --- bloggers excerpt

Quote: https: //www.cnblogs.com/myBlogInWork/p/8657125.html

Result of the need to use php + oracle to write a project, and therefore have the following:

Originally thought have a default oracle php module, packaged with enough to take over the function, after the discovery is not as simple, not to say the whole process through, spent a lot of effort, a lot of Baidu, found relevant experience is relatively small, I decided to write down.

The whole process is as follows:

  1. Check local php version information (cmd: php -v or echo phpinfo ())

$YF0HA[E$92O_]J9]}@}[3G.png

2. Download the corresponding version of the oracle instant client

http://www.oracle.com/technetwork/cn/database/features/instant-client/index-092699-zhs.html

X86 32-bit version of the corresponding

KB[4M~}R{8WZVYSY}~V9$]0.png

The plan focused on: the need to download two compressed packages, the installation path to unity, please optimistic about "basicLIte" and sqlplus version, and the version number of unification

Specific installation procedure, see: https://www.cnblogs.com/ivictor/p/3898702.html

  Seen, if only SQL Developer is connected to the database server, the database manipulation or SQL * Plus, with respect to the standard client,

  Oracle Instant Client is a better choice, it greatly simplifies the installation of the client, take up little space, but includes the requisite OCI, OCCI interfaces and ODBC, JDBC driver.

  Download Link: http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

  Because version of our back-end database is 11.2.0.1 32 bits at the same time we need to install client-side below the windows, so the download

  【php】

  instantclient-basic-win32-11.2.0.1.0.zip (51,458,190 bytes)

  instantclient-sqlplus-win32-11.2.0.1.0.zip (758,913 bytes)

Let's look at how to install.

First, the instantclient-basic and instantclient-sqlplus two packages are located in the same directory, unzip .

       Here, we put E: \ under Oracle, extract to the current folder, then automatically generates a new folder instantclient_11_2, two installation package files are placed in the folder, ie E: \ Oracle \ instantclient_11_2 .

Second, modify system variables

       1> E: \ Oracle \ instantclient_11_2 added to the system PATH variable

       2> New System Variables

                NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252 - >> server-side character set

                TNS_ADMIN = E: \ Oracle \ instantclient_11_2 - >> specify the location where the tnsnames.ora

        Note: If you install a variable system online method is still not in force, then you need to restart the computer for the changes to take effect system variables.

Third, in the E: \ Oracle \ instantclient_11_2 under the new tnsnames.ora configuration file, as follows:

 

orcl =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.11)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.being.com)
    )
  )

Fourth, use SQL * Plus landing tests.

    C:\WINDOWS\system32>sqlplus scott/tiger@orcl

SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 8 10:17:53 2014 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL>

Test ok!

So far, Oracle Instant Client and SQl * Plus installation is complete.

 

3. Download oci Expansion Pack

http://pecl.php.net/package/oci8   be selected

[LE]%({{L%$O1PR~H((9D6Y.png

Note that the three pieces of information corresponding to three frames in the first step

After downloading unzip, copy the .dll files related to the environment php extensions folder

xampp environment: ../ xampp / php / ext

4. After installing the verification, modify the PHP configuration file php.ini file, add the extension

extension=php_oci8.dll

extension=php_oci8_12c.dll(具体扩展版本号根据自己第三步中安装的oci版本匹配)

5.全部进行完之后可重复进行第一部验证,发现phpinfo中多了oci模块,否则请重新仔细检查前几步是否完全正确

PT4}1S7{CEZK1T_%8TJ1SDQ.png

 

需要注意的是,部署sqlserver不用重启电脑,部署oracle需要重启电脑。

 

 

引用 :https://www.cnblogs.com/myBlogInWork/p/8657125.html

由于工作需要,要用到php+oracle写个项目,故而有了以下内容:

本来以为php有默认的oracle模块,封装好的函数拿过来用就好了,后发现并不像那么简单,整个过程经过就不说了,费了很大功夫,百度了好多,发现相关的经验也比较少,决定写下来了。

整个过程如下:

  1. 查看本地的php版本信息(cmd :php -v   或者 echo  phpinfo())

$YF0HA[E$92O_]J9]}@}[3G.png

2.下载对应版本的oracle instant client

http://www.oracle.com/technetwork/cn/database/features/instant-client/index-092699-zhs.html

X86  对应32 位版本

KB[4M~}R{8WZVYSY}~V9$]0.png

划重点了:需要下载这两个压缩包 ,安装到统一路径下,请看好是“basicLIte”sqlplus版本 ,并且版本号统一

具体安装过程 参见:https://www.cnblogs.com/ivictor/p/3898702.html

  可见,如果仅仅是用SQL Developer连接数据库服务器端,或用SQL*Plus对数据库进行操作,相对于标准的客户端,

  Oracle Instant Client都是一个更好的选择,它大大简化了客户端的安装过程,占用空间极少,却包括必备的OCI、OCCI接口和ODBC、JDBC driver。

  下载链接:http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

  因为我们后台数据库的版本是11.2.0.1 32位,同时我们需要在windows下面安装客户端,故下载

  【php】

  instantclient-basic-win32-11.2.0.1.0.zip (51,458,190 bytes)

  instantclient-sqlplus-win32-11.2.0.1.0.zip (758,913 bytes)

下面来看看如何安装。

一、 将instantclient-basic和instantclient-sqlplus两个安装包放在同一个目录下,解压

       在这里,我们放在E:\Oracle下,解压到当前文件夹,最后会自动生成一个新的文件夹instantclient_11_2,两个安装包的文件都会放到该文件夹下,即                          E:\Oracle\instantclient_11_2。

二、 修改系统变量

       1> 将E:\Oracle\instantclient_11_2添加到系统变量PATH中

       2> 新增系统变量

                NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252   -->> 服务器端字符集

                TNS_ADMIN=E:\Oracle\instantclient_11_2       -->> 指定tnsnames.ora所在位置

        注意:如果安装网上方法系统变量依然没有生效的话,需重启电脑让修改的系统变量生效。

三、 在E:\Oracle\instantclient_11_2 下新建tnsnames.ora配置文件,内容如下:

 

orcl =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.11)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.being.com)
    )
  )

四、 用SQL*Plus登陆测试。

    C:\WINDOWS\system32>sqlplus scott/tiger@orcl

SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 8 10:17:53 2014 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL>

测试ok!

至此,Oracle Instant Client和SQl*Plus安装完成。

 

3.下载oci扩展包

http://pecl.php.net/package/oci8  根据需要选择

[LE]%({{L%$O1PR~H((9D6Y.png

注意这里的三个框对应第一步中的三项信息

下载后解压,将相关.dll文件复制到php环境扩展文件夹中

xampp环境为:../xampp/php/ext

4.安装好验证之后,修改PHP配置文件php.ini 文件,增加扩展

extension=php_oci8.dll

extension = php_oci8_12c.dll (particularly the extension version number The version oci installed in their third step match)

5. All can be repeated after the completion of the first verification carried out and found that in more than a phpinfo oci module, otherwise please double check before steps are completely correct

PT4}1S7{CEZK1T_%8TJ1SDQ.png

 

It should be noted that the deployment of sqlserver do not restart the computer, deploy oracle need to restart the computer.

 

 

Guess you like

Origin www.cnblogs.com/hhmm/p/11547022.html