In Linux, Apache + PHP + MySql + Cgi_MySQL

Source: Internet
Author: User
Apache1.3.24 + php4.21 + mysql3.23.49 + openssl + mod_ssl + mod_perl + mod_fastcgi note that apache1.3x can use static php module 2. x. x currently only supports dynamic, and does not have a windows version to install the required software package: apache_1.3.24.tar.gzphp-4.2.1.tar.gzmysql-3.23.49.tar.gzmod_fastc Apache


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. a -- activate-module = src/modules/perl/libperl. a
  
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:
  
DirectoryIndex index.html
  
  
Changed:
  
DirectoryIndex index.html index. php
  
  
Add one to the file:
AddType application/x-httpd-php. php
  
The setting is complete.
  
9) Debugging
  
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

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.