Installation Tutorials for Integrating Linux, Apache, PHP4, FastCGI, Oracle, and MySQL environments

Source: Internet
Author: User
Tags dba ini mkdir mysql client mysql tutorial php tutorial prepare oracle database

I. Preparations
To integrate the Linux/Apache/PHP4/FastCGI/Oracle/MySQL environment, you must first prepare the following software packages:

(1) Perl interface for database tutorials

1. perl5 Oracle DBI Driver: DBD-Oracle-1.03.tar.gz

2. perl5 universal database interface program: DBI-1.13.tar.gz

3. perl5 MySQL database DBI Driver: Msql-Mysql-modules-1.2209.tar.gz

(2) Oracle Database

4. Oracle 8iR2 (8.1.6) for Linux: oracle8161.tar.gz

(3) MySQL database

5. MySQL 3.22.32 server package: MySQL-3.22.32-1.i386.rpm

6. MySQL client package: MySQL-client-3.22.32-1.i386.rpm

7. MySQL development kit (header file/library file): MySQL-devel-3.22.32-1.i386.rpm

8. MySQL shared library package: MySQL-shared-3.22.32-1.i386.rpm

(4) Apache server

9. Apache 1.3.12 Source Code tutorial package: apache_1.3.12.tar.gz

(5) PHP module

10. PHP 4.0.0 source package: PHP Tutorial -4.0.0.tar.gz

(6) FastCGI module

11. FastCGI module source code package: mod_fastcgi_2.2.4.tar.gz

12. FastCGI perl Development Module: FCGI-0.53.tar.gz

2. Install the Oracle client
Because Oracle 8.1.6 is installed in XWindows, you must configure XWindow in advance. If your video card does not support XWindow, you can also use exceed for remote installation (not to mention remote installation ).

Here is a simple list of operations:

(1) set environment variables:

Add the following to/etc/profile:

Export ORACLE_HOME =/opt/oracle8i/u01

Export ORACLE_BASE =/opt/oracle8i

Export ORACLE_OWNER = oracle

Export ORACLE_SID = ORCL

Export ORACLE_TERM = ansi

Export PATH = $ PATH: $ ORACLE_HOME/bin

Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib

Export ORA_NLS33 = $ ORACLE_HOME/ocommon/nls/admin/data

Export NLS_LANG = "SIMPLIFIED CHINESE_CHINA.ZHS16CGB231280"

(2) establish oracle groups and users

#/Usr/sbin/groupadd dba

#/Usr/sbin/useradd-g dba oracle

#/Usr/bin/passwd oracle

(3) create the $ ORACLE_HOME Directory

# Mkdir/opt

# Mkdir/opt/oracle8i

# Mkdir/opt/oracle8i/u01

# Chown-R oracle. dba/opt

(4) install reacle 8iR2

Log on as an oracle User and unlock the Oracle installation package:

$ Tar zxvf oracle8161.tar.gz

$ Startx start the XWindow interface and open a rxvt terminal window

$ Cd Oracle8iR2

$./RunInstaller

In this case, the Oracle installation interface is displayed. During installation, select install client/Application User (if the Oracle server is not running on the local machine, there is another dedicated machine ), after installation, configure SQL * Net8 and test whether the connection to the remote server is successful.

3. Install the MySQL server and client
Install MySQL packages as root:

# Rpm-ivh MySQL-3.22.32-1.i386.rpm

# Rpm-ivh MySQL-client-3.22.32-1.i386.rpm

# Rpm-ivh MySQL-devel-3.22.32-1.i386.rpm

# Rpm-ivh MySQL-shared-3.22.32-1.i386.rpm

4. Install the database interface module of Perl
Enter as root, and then execute:

# Tar zxvf DBI-1.13.tar.gz

# Cd DBI-1.13

# Perl Makefile. PL

# Make

# Make test

# Make install

# Cd ..

# Rm-rf DBI-1.13

#

# Tar zxvf DBD-Oracle-1.03.tar.gz

# Cd DBD-Oracle-1.03

# Perl Makefile. PL

# Make

# Make test

# Make install

# Cd ..

# Rm-rf DBD-Oracle-1.03

#

# Tar zxvf Msql-Mysql-modules-1.2209.tar.gz

# Cd Msql-Mysql-modules-1.2209

# Perl Makefile. PL

Select 1 (MySQL) and y (Mysql. pm supported)

# Make

# Make test

# Make install

#

5. Install Apache + PHP + FastCGI
(1) unpack the Apache/PHP/FastCGI package:

# Tar zxvf apache_1.3.12.tar.gz

# Tar zxvf php-4.0.0.tar.gz

# Tar mod_fastcgi_2.2.4.tar.gz

(2) compile PHP4

Configure apache compilation parameters

# Cd apache_1.3.12

#./Configure -- prefix =/usr/local/apache

Configure PHP compilation parameters

# Cd ../php-4.0.0

#./Configure -- with-apache = ../apache_1.3.12

> -- With-mysql tutorial

> -- With-oracle = $ ORACLE_HOME

> -- With-oci8 = $ ORACLE_HOME

> -- Enable-track-vars

Compile the PHP module:

# Make

# Make install

Create a php. ini parameter file

# Cp php. ini-dist/usr/local/lib/php. ini

# Cd ..

(3) add the FastCGI module:

# Mv mod_fastcgi_2.2.4 apache_1.3.12/src/modules/fastcgi

(4) compile and install Apache

# Cd apache_1.3.12

Configure compilation parameters

#./Configure -- prefix =/usr/local/apache

> -- Activate-module = src/modules/php4/libphp4.a

> -- Activate-module = src/modules/fastcgi/libfastcgi.

Compile Apache

# Make

Install Apache

# Make install

(5) disable Apache from the original system

#/Etc/rc. d/init. d/httpd stop

(6) configure Apache parameters:

1. Edit the/usr/local/apache/conf/httpd. conf file and modify the following parameters:

ServerName host. mydomain. name

DocumentRoot "/home/httpd/html"

Options Indexes FollowSymLinks MultiViews Includes

AllowOverride None

Order allow, deny

Allow from all

ScriptAlias/cgi-bin/"/home/httpd/cgi-bin /"

AllowOverride None

Options None

Order allow, deny

Allow from all

DirectoryIndex index.html index. phtml index. php index.htm index.shtml index. fcgi

2. Modify the auto-start link

# Cd/etc/rc. d/init. d

# Ln-fs/usr/local/apache/bin/apachectl httpd

(7) configure the PHP4.0 parameters:

1. Modify the/usr/local/apache/conf/httpd. conf file and modify the following parameters:

Add a row: AddType application/x-httpd-php. php. phtml. php3

2. Modify the/usr/local/apache/bin/apachectl script to enable support for the Chinese ORACLE environment:

Add the following lines to the 66 rows ("start)") of the file:

Export ORACLE_HOME =/opt/oracle8i/u01

Export ORACLE_BASE =/opt/oracle8i

Export ORACLE_SID = ORCL

Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib

Export ORA_NLS33 = $ ORACLE_HOME/ocommon/nls/admin/data

Export NLS_LANG = "SIMPLIFIED CHINESE_CHINA.ZHS16CGB231280"

3. Modify/usr/local/apache/conf/srm. conf to use environment variables in CGI programs:

PassEnv ORACLE_HOME

PassEnv ORACLE_BASE

PassEnv LD_LIBRARY_PATH

PassEnv NLS_LANG

PassEnv ORACLE_SID

PassEnv PATH

(8) configure the FastCGI execution environment:

1. Modify the/usr/local/apache/conf/httpd. conf file and modify the following parameters:

Add several lines:

########### FastCGI Configures Begin ######################### #

AddHandler fastcgi-script. fcg. fcgi. fpl

SetHandler fastcgi-script

Order deny, allow

Allow from all

Options ExecCGI Indexes Includes

############## FastCGI Configure End ###################### #####

2. Create the fcgi execution Directory

# Mkdir/home/httpd/html/fcgi

3. Install the Perl running module of FCGI:

# Tar zxvf FCGI-0.53.tar.gz

# Cd FCGI-0.53

# Perl Makefile. PL

# Make

# Make install

6. Start and test
1. Start the Apache server:

#/Etc/rc. d/init. d/httpd start

2. Compile the PHP test program:

First test program:/home/httpd/html/t1.php;

The second test is the PHP program connecting PHP to Oracle (the table has been created): Check whether it is a Chinese output;

The third test is the PHP program connected to MySQL (the table has been created ).

3. Compile the FastCGI test code:/home/httpd/html/fcgi/test. fcgi

#! /Usr/bin/perl

Use FCGI;

Use DBI;

$ Dbname = "oracle ";

$ User = "user ";

$ Passwd = "password ";

$ Dbh = "";

While (FCGI: accept ()> = 0 ){

& Parse_form ();

$ Id = $ FORM {"id "};

$ Para = $ FORM {"para "};

Print "Content-type: text/html ";

Print "";

If (! $ Dbh ){

Print "no oracle, need to connect ";

$ Dbh = DBI-> connect ("dbi: Oracle: $ dbname", $ user, $ passwd );

} Else {

Print "OK, oracle aleady connected ";

}

$ Something = $ dbh-> prepare ("select name from testtable where id = 15 ");

$ Something-> execute;

@ Recs = $ Something-> fetchrow_array;

$ Something-> finish;

Print "Parameter id =". $ id. "and my name is @ recs [0]";

Print "parameter para =". $ para ."";

}

#### Input parameter processing #######

Sub parse_form {

My ($ buffer );

My ($ pairs );

My (@ pairs );

My ($ name );

My ($ value );

My $ meth = $ ENV {"REQUEST_METHOD "};

If ($ meth eq "GET" | $ meth eq "HEAD "){

$ Buffer = $ ENV {"QUERY_STRING "};

}

Elsif ($ meth eq "POST "){

Read (STDIN, $ buffer, $ ENV {"CONTENT_LENGTH "});

}

Undef % FORM;

@ Pairs = split (//, $ buffer );

Foreach $ pair (@ pairs ){

($ Name, $ value) = split (/=/, $ pair );

$ Value = ~ Tr/+ //;

$ Value = ~ S/% ([a-fA-F0-9] [a-fA-F0-9])/pack ("C", hex ($1)/eg;

$ Value = ~ S // g;

If ($ allow_html! = 1 ){

$ Value = ~ S/] |) *> // g;

}

$ FORM {$ name} = $ value;

}

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.