


Install oracle client under Linux and configure php5.3, oraclephp5.3
Since the project requires the Oracle client compilation of php5.3 under Linux, I would like to briefly introduce the steps and detours taken.
1. Download the Oracle client package, which contains related files such as OCI, OCCI and JDBC-OCI.
1.1 Download file address
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
Select the corresponding software according to the version of the operating system. What I need is X86_64 selection
Instant Client for Linux x86-64
The files that need to be downloaded for 1.2 are as follows:
oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm
oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm
oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.x86_64.rpm
One thing that needs to be emphasized is that you need to register an oracle account to download normally.
2. Install the Oracle client package.
Upload the program package to the specified directory on the server
chmod +x *.rpm
#Give execution permissions to the RPM package
rpm -ivh oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm oracle-instantclient11.1-sqlplus-11.1 .0.7.0-1.x86_64.rpm
#Install RPM package
echo "/usr/lib/oracle/11.1/client64/lib/" > /etc/ld.so.conf.d/oracle_client.conf
#Add the library path to the default load
/sbin/ldconfig
#Reload dynamic link library
3. Install the OCI8 php extension (the installation path of php specified here is /usr/local/webserver/php)
yum install libaio
#yum installs the libaio library. libaio is an asynchronous non-blocking interface under Linux. It provides a way to read and write files in an asynchronous non-blocking way, and the reading and writing efficiency is relatively high
wget http://pecl.php.net/get/oci8-1.4.10.tgz
#DownloadOCIExtension
tar zxvf oci8-1.4.10.tgz
#unzip
cd oci8-1.4.10
/usr/local/webserver/php/bin/phpize CFLAGS="-I/usr/lib/oracle/11.1/client64" CXXFLAGS="-I/usr/lib/oracle/11.1/client64"
#Use phpize to prepare the compilation environment of the PHP plug-in module. The makefile required for compilation will be generated according to the specified environment variables. phpize is the content of php-devel, so under centos, just run yum install php-devel to install it
./configure –with-php-config=/usr/local/webserver/php/bin/php-config –with-oci8=/usr/lib/oracle/11.1/client64
make
make install
#Compile, install
It should be emphasized that when making, an error will be reported, showing that various library files cannot be found. The makefile needs to be modified to add the runtime address of oralce
Open the makefile and look for INCLUDE in the following form:
INCLUDES = -I/usr/local/php/include/php -I/usr/include/oracle/10.2.0.3/client
Then add =="-I/usr/lib/oracle/11.1/client64 at the end, and then make again and it will succeed.
4. Modify PHP.ini (/usr/local/webserver/php/etc/php.ini)
Add a line after extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/":
extension = "oci8.so"
5. Restart apache to allow OCI to take effect
6. Create the phpinfo.php file in the web directory, enter the content in it, and access it through the web
phpinfo();
?>
If you find the OCI8 part, it means that the OCI installation is normal, as shown in the picture below
Next, you can access the Oracle database through PHP. What you need to pay attention to is the Oracle connection string under PHP
$username='***';
$passwd='***';
$protocol='TCP';
$SERVICE_NAME='***';
$ORACLE_SERVER_IP_ADDRESS='***.***.***.***';
$Port='1521′;
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = $protocol)(HOST = $ORACLE_SERVER_IP_ADDRESS)(PORT = $Port)))(CONNECT_DATA=(SID=$SERVICE_NAME)))";
$conn = oci_connect($username,$passwd, $db);
PutEnv("NLS_LANG=SIMPLIFIED CHINESE_CHINA.AL32UTF8");
if (!$conn) {
$e = oci_error();
Print htmlentities($e['message']);
exit;
}else {
echo "Connection to oracle successful!";
Return $conn;
}
?>
Install rpm as root user -ivh oracle-instantclient-basic-11.1.0.1-1.x86_64.rpmrpm -ivh oracle-instantclient-sqlplus-11.1.0.1-1.x86_64.rpm configure vim /etc/profile add export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client64export ORACLE_BASE=/usr/lib/oracle/11.1.0.1export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATHexport NLS_LANG=AMERICAN_AMERICA.AL32UTF8 After setting the environment variables, you need to restart the machine! Create the configuration file. Create the following directory network/admin in the ORACLE_HOME directory, and create the file tnsnames.ora with the following content: vim /usr/lib/oracle/11.1.0.1/client64/network/admin/tnsnames.ora# tnsnames.ora Network Configuration File: /opt/oracle10g/u01/network/admin/tnsnames.ora# Generated by Oracle configuration tools.111 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.111)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = dmsdb) ) ) Test to the ORACLE_HOME/bin directory and execute the command: [yleesun@centos bin]$ ./sqlplus zxd/zxd@111Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL>Test successful! Note: If the following error occurs: sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory, the environment variable does not take effect!
Install as root user
rpm -ivh oracle-instantclient-basic-11.1.0.1-1.x86_64.rpm
rpm -ivh oracle-instantclient-sqlplus-11.1.0.1-1.x86_64.rpm configuration
vim /etc/profile add
export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client64
export ORACLE_BASE=/usr/lib/oracle/11.1.0.1
export LD_LIBRARY_PATH=$ ORACLE_HOME/lib:$LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
After setting the environment variables, you need to restart the machine!
Create configuration file
Create the following directory network/admin in the ORACLE_HOME directory, and create the file tnsnames.ora with the following content:
vim /usr/lib/oracle/11.1.0.1/client64/network/admin /tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle10g/u01/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.111 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.111)(PORT = 1521)))
(CONNECT_DATA =
(SERVICE_NAME = dmsdb))) TEST
to ORACLE_HOME /bin directory, execute the command:
[yleesun@centos bin]$ ./sqlplus zxd/zxd@111
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL test successful! Note:
If the following error occurs:
It means the environment variable does not take effect!

linux设备节点是应用程序和设备驱动程序沟通的一个桥梁;设备节点被创建在“/dev”,是连接内核与用户层的枢纽,相当于硬盘的inode一样的东西,记录了硬件设备的位置和信息。设备节点使用户可以与内核进行硬件的沟通,读写设备以及其他的操作。

区别:1、open是UNIX系统调用函数,而fopen是ANSIC标准中的C语言库函数;2、open的移植性没fopen好;3、fopen只能操纵普通正规文件,而open可以操作普通文件、网络套接字等;4、open无缓冲,fopen有缓冲。

端口映射又称端口转发,是指将外部主机的IP地址的端口映射到Intranet中的一台计算机,当用户访问外网IP的这个端口时,服务器自动将请求映射到对应局域网内部的机器上;可以通过使用动态或固定的公共网络IP路由ADSL宽带路由器来实现。

在linux中,交叉编译是指在一个平台上生成另一个平台上的可执行代码,即编译源代码的平台和执行源代码编译后程序的平台是两个不同的平台。使用交叉编译的原因:1、目标系统没有能力在其上进行本地编译;2、有能力进行源代码编译的平台与目标平台不同。

在linux中,eof是自定义终止符,是“END Of File”的缩写;因为是自定义的终止符,所以eof就不是固定的,可以随意的设置别名,linux中按“ctrl+d”就代表eof,eof一般会配合cat命令用于多行文本输出,指文件末尾。

linux查询mac地址的方法:1、打开系统,在桌面中点击鼠标右键,选择“打开终端”;2、在终端中,执行“ifconfig”命令,查看输出结果,在输出信息第四行中紧跟“ether”单词后的字符串就是mac地址。

在linux中,可以利用“rpm -qa pcre”命令判断pcre是否安装;rpm命令专门用于管理各项套件,使用该命令后,若结果中出现pcre的版本信息,则表示pcre已经安装,若没有出现版本信息,则表示没有安装pcre。

在linux中,rpc是远程过程调用的意思,是Reomote Procedure Call的缩写,特指一种隐藏了过程调用时实际通信细节的IPC方法;linux中通过RPC可以充分利用非共享内存的多处理器环境,提高系统资源的利用率。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version
Recommended: Win version, supports code prompts!
