Apache2 + PHP + Oracle9 installation

xiaoxiao2021-03-06  41

1 Introduction:

For UNIX (Linux), Apache PHP is a good choice. For small websites, the more general is Apache PHP MySQL, and the advantage is not more than saying. However, for large websites, you need to retrieve the database and the connection request, Mysql still has his limitations. Many portals, such as: sina, tom, sohu, china, etc., all use the generation static page of the newsletter. However, this newsletter, many of which are completed through Apache PHP, and a large amount of information is placed in the database, when the user is accessed, the static page is generated by the program. Therefore, Apache PHP Oracle is a relatively reasonable choice.

Since the SUN SPARC machine is usually used, this environment is temporary, it is redhat9. If you like to use the redhat AD, you need to test it first.

2, structure:

Two hosts:

ODB - Install Oracle Server as data storage.

WebApp --- Install Oracle Client and Apache PHP, PHP Access Oracle via Oracle Client.

ODB IP: 192.168.1.2

WebApp IP: 192.168.1.111.11.11.11

Advantages: Safety, ODB can use the intranet IP, but also achieve reduced WebApp's load.

3, host system related software:

RedHat9

Oacle9 for liunx

httpd2.0.50

PHP-4.32

4, install the software:

4.1, ODB installation:

Here is installation on the redhat9 of Oracle9. You can view other articles responding to the forum, but more written here. For the context, the library is established here for ODB.

4.2, Apache2 installation:

# TAR zxvf httpd-2.0.49.tar.gz

# Cd httpd-2.0.49

# ./Configure --prefix = / opt / apache --enable-so --with-mpm = worker

# Make

# Make install

4.3, Oracle Client Installation on the WebApp host:

4.3.1 Install the RedHat9.0 operating system to ensure the following RPM development package is installed

GCC

CPP

GLIBC-Devel

Compat-libstdc

GLIBC-KernHeaders

Binutils

You can use the command to see if these packs have been installed.

RPM -Q GCC CPP Compat-LibSTDC Glibc-Devel Glibc-Kernheaders Binutils

4.3.2, download the Oracle9i installation file from the official website of Oracle and use the following command to unpack

# Zcat lnx_920_disk1.cpio.gz | CPIO -IDMV

# Zcat lnx_920_disk2.cpio.gz | CPIO -IDMV

# Zcat lnx_920_disk3.cpio.gz | CPI -IDMV

Then there will be three subdirectories of Disk1 Disk2 Disk3.

4.3.3 Setting the kernel parameters

# Echo 4294967295> / proc / sys / kernel / shmmax, it is recommended to put it in the /etc/rc.local file.

Or edit /etc/sysctl.conf

Kernel.shmmax = 4294967295

I have 512MB memory, so set this value. It can be set according to the actual situation. 4.3.4, create an Oracle user account and installation directory

Under the shell, as root

# GroupAdd DBA

# GroupAdd Oinstall

# Useradd -g oinstall -g dba oracle

# Passwd Oracle

# MKDIR / OPT / ORACLE

# MKDIR / OPT / ORACLE / PRODUCT

# Mkdir /opt/oracle/Product/9.2.0

# Chown -r oracle.oinstall / OPT / ORACLE

# MKDIR / VAR / ORACLE

# Chown oracle.dba / var / oracle

# Chmod 755 / var / oracle

4.3.5, set environment variables

# Vi /home/oracle/.bash_profile file, add the following list

------------

Export ld_assume_kernel = 2.4.1

Export oracle_base = / opt / oracle

Export Oracle_Home = / OPT / ORACLE / Product / 9.2.0

NLS_LANG = "Simplified Chinese_China.zHS16GBK"; Export NLS_LANG

ORA_NLS33 = $ Oracle_Home / Ocommon / NLS / Admin / Data; Export ORA_NLS33

LD_LIBRARY_PATH = $ ORACLE_HOME / LIB: / LIB: / USR / LIB; Export LD_Library_Path

PATH = $ PATH: $ oracle_home / bin; export path

----------------

4.3.6, installation

You can restart the machine, let the settings of the parameters take effect, let the Oracle user log in and install Oracle.

# ~ Disk1

# ./Runinstaller

When installing, choose to install the client.

Has prompt you to perform a few scripts with root users, follow the prompts.

4.4, PHP installation

When installing PHP, PHP calls Oracle9 (9.0.2 --10), you need to install a patch, or there will be problems. But there is no problem with Oracle8 version. Oracle's official website has downloaded, the address is as follows:

Http://otn.racle.com/products/ias/ohs/htdocs/ociheaders.tar

# Cp ociheaders.tar /opt/oracle/product/9.2.0/neetwork/rdbms/demo/

# Cd cd/opt/oracle/product/9.2.0/neetwork/rdbms/demo

# Tar xvf ociheaders.tar

# TAR ZXVF PHP-4.3.2.tar.gz

# CD PHP-4.3.2

# ./Configure --prefix = / opt / php --with-zlib

--with-apxs2 = / opt / apache / bin / apxs --disable-xml --without-mysql

--with-oci8 = / OPT / Oracle / Product / 9.2.0

--with-config-file-path = / opt / php / etc / php.ini - disable-rpath --without-pear

# Make

# Make install

# MKDIR / USR / local / PHP / ETC

# Cp /Home/peng/php-4.3.2/etc/php.ini-disk /usr/local/php/etc/php.ini/php.ini

# Vi /usr/local/php/etc/php.ini/php.ini

5 Configure the software:

5.1, launch Oracle on the ODB host:

Log in with an Oracle user:

Start database

$ SQLPLUS "/ as sysdba"

SQL> Startup

Start listener

$ Lsnrctl

5.2, configure Apache2:

# Vi /opt/apache/conf/httpd.conf

Add: AddType Application / X-httpd-php .php

Change the following options as follows:

Listen 211.11.11:80 - Your Publish Host IP

User Nobody

Group nobody

DirectoryIndex Index.html Index.php

AddDefaultCharset Off

5.3 Configuring PHP:

# Vi /usr/local/php/etc/php.ini/php.ini

change:

Register_global = OFF is register_global = ON

5.4 Configuring Oracle Client:

# Vi /opt/oracle/product/9.2.0/neetwork/admin/tnsnames.ora

-------------

ODB =

(Description =

(Address_list =

(Address = (Protocol = TCP) (Host = 192.168.1.2) (port = 1521)))

)

(Connect_data =

(Service_name = ODB)

)

)

----------------

Here, the system has been all installed, and the specific host settings of Apache are required according to their own situation.

to sum up:

APCHE PHP Oracle's general application is a relatively large amount of database access, or is often used in database retrieval applications. Many environments set up for application servers.

It is noted here that this environment is equipped, the same is suitable for Oracle10. If you use Oracle817 or less, you don't need to install OCIHeaders. For Oracle7, PHP is used to use -with-oracle = parameters.

statement:

When writing articles, it is inevitable to refer to many netizen information, if there is a similar, not necessarily a coincidence.

In the spirit of freedom, sharing, netizens can repume it, please indicate the author and source when reposing.

转载请注明原文地址:https://www.9cbs.com/read-77015.html

New Post(0)