APACHEPHPMYSQLCGI modified in Linux

Source: Internet
Author: User


Based on a self-claimed asshole article
Many articles are combined.
MOD_PERL, FASTCGI. I didn't debug it because I didn't like CGI. The chmod mysql column is stuck twice. If there is a problem, you can perform the experiment back and forth.

In Linux, apache + mysql + php ^ (Modified Version)

Alas, there are so many articles and versions on the Internet, and there are more or less some problems. It takes one day to solve the problems and errors and modify some wrong places, the final version is below.

Apache1.3.24 + php4.21 + mysql3.23.49 + openssl + mod_ssl + mod_perl + mod_fastcgi
Note that the static php module can be used for apache 1.3x.
2. x. x can only be used dynamically at present, and there is no windows version.

The required software package for this installation:
Apache_1.3.24.tar.gz
Php-4.2.1.tar.gz
Mysql-3.23.49.tar.gz
Mod_fastcgi-2.2.12.tar.gz
Mod_perl-1.26.tar.gz
Mod_ssl-2.8.8-1.3.24.tar.gz
Openssl-0.9.6d.tar.gz

Although the apache version has reached 2.0.36, it does not seem to be in the trial phase from other materials, and the latest php 4.21 cannot be compiled as a static module of apache 2.0.xx. The current installation uses compiling as a static module, so the new version of apache is not used.

######################################## ###########

Installation:

Put these packages in a directory, such as/usr/local/src
Decompress these packages:
Tar xzvf apche_1.3.24.tar.gz
Tar xzvf php-4.2.1.tar.gz
Tar xzvf mysql-3.23.49.tar.gz
Tar xzvf mod_fastcgi-2.2.12.tar.gz
Tar xzvf mod_perl-1.26.tar.gz
Tar xzvf mod_ssl-2.8.8.-1.3.24.tar.gz
Tar xzvf openssl-0.9.6d.tar.gz

After decompression, the folder generated after compression is displayed in the current directory.

Configure and compile now:

1. First install MySQL
PTH. Oh, don't forget.
1) create a MySQL user group:

Groupadd mysql
Useradd-g mysql

2) configure and compile

Cd mysql-3.23.49
./Config -- prefix =/usr/local/mysql

If you want to use MySQL transactions, you can add -- with-berkeley-db, that is:

./Configure \
-- Prefix =/usr/local/mysql \
-- With-berkeley-db

After the configuration is complete, you can compile it.

3) Compile and install
Compilation is simple, with only one command

Make

Then install

Make install

4) initialization
The installation is not complete yet. There are several steps to initialize the database first.

Scripts/mysql_install_db

Then, Set permissions.

Chown-R root/usr/local/mysql
Chown-R mysql/usr/local/mysql/var
Chgrp-R mysql/usr/local/mysql

Copy the my. cnf file required to start MySQL to the/etc directory.

Cp/usr/local/mysql/share/mysql // my-medium.cnf/etc/my. cnf
(There are three files, my-small.cnf, my-large.cnf and my-huge.cnf,
For machine performance, the last one is applicable to about 2 GB memory

5) Start

/Usr/local/mysql/bin/safe_mysqld -- user = mysql &

You can see the startup information. At this time, you should set a password for the root user, because after installation, there is no password by default.

6) set a password for the root user

/Usr/local/mysql/bin/mysqladmin-u root-p password your_new_password

Note that the First password is the command parameter and is typed as is, and your_new_password is the new password you want to set. For example, to set the root password to 123456, enter the following command:

/Usr/local/mysql/bin/mysqladmin-u root-p password 123456

After you press enter, the system will prompt you to enter the current password, which should be like the following:

Enter password:

Because there is no password at this time, you can press enter directly. At this time, no prompt is returned, and the password has been set. In this case, you can disable the MySQL service to verify that the password has taken effect:

/Usr/local/mysql/bin/mysqladmin-u root-p shutdown
Enter password: 123456

The system prompts that MySQL is disabled:

020531 13:14:35 mysql ended
[1] + Done/usr/local/mysql/bin/safe_mysqld -- user = mysql

######################################## ##################################

2. install apache + php + other modules

Configure the module first

Cd/usr/local/src

1) Move the fastcgi directory to the Module Directory of apache and rename it fastcgi

Mv mod_fastcgi-2.2.12 apache_1.3.24/src/modules/fastcgi

2) configure and compile the openssl Module

Cd/usr/local/src/openssl-0.9.6d
Sh config
Make
Make test

3) Configure mod_ssl

Cd/usr/local/src/mod_ssl-2.8.8-1.3.24
./Configure -- with-apache = ../apache_1.3.24

4) configure and compile and install mod_perl

Cd/usr/local/src/mod_perl-1.26
Perl Makefile. PL \
APACHE_SRC = ../apache_1.3.24/src \
DO_HTTPD = 1 \
USE_APACI = 1 \
PRE_HTTPD = 1 \
EVERYTHING = 1

Then compile

Make

Then test the compilation result.

Make test

Install

Make install

5) Configure apache

Cd/usr/local/src/apache_1.3.24
SSL_BASE = ../openssl-0.9.6d./configure \
-- Prefix =/usr/local/apache \
-- Enable-module = ssl \
-- Activate-module = src/modules/fastcgi/libfastcgi. \
-- Activate-module = src/modules/perl/libperl.

Now the apache configuration has been preliminarily completed, and the php configuration will be completed.

6) configure the compilation and installation php-4.2.1

Cd/usr/local/src/php-4.2.1
./Configure \
-- With-mysql =/usr/local/mysql \
-- With-apache = ../apache_1.3.24 \
-- Enable-track-vars \
-- Enable-trans-sid \
-- With-gd

Then compile

Make

Install

Make install

7) Reconfigure and compile and install apache

Cd/usr/local/src/apache_1.3.24
./Config. status \
-- Activate-module = src/modules/php4/libphp4.a

Compile

Make

Install

Make certificate
Make install

8) Final settings

Cd/usr/local/src/php-4.2.1
Cp php. ini-dist/usr/local/lib/php. ini

You can edit php. ini as needed

Edit httpd. conf in the/usr/local/apache/conf directory

Find:
<IfModule mod_dir.c>
DirectoryIndex index.html
</IfModule>

Changed:
<IfModule mod_dir.c>
DirectoryIndex index.html index. php
</IfModule>

Add one to the file:
AddType application/x-httpd-php. php

The setting is complete.

9) debugging

I don't need to talk about this.

Load mysql at system startup
Cp/usr/local/mysql/share/mysql. server/etc/rc. d/init. d/mysql
Cd/etc/rc. d/rc3.d
Ln-s ../init. d/mysql S70mysql

Load apache at system startup
Cp/usr/local/apache/bin/apachectl/etc/rc. d/init. d/httpd
Cd/etc/rc. d/rc3.d
Ln-s ../init. d/httpd S80httpd

10) adding the ZEND accelerator is quite useful.
The latest 1. Version 31, whether in Windows or LINUX, follow the prompts to proceed step by step.
In LINUX, It's./install. sh.

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.