Detailed installation and configuration of apatche + mysql + php in linux (available for download)

Source: Internet
Author: User
Tip: If some graphics libraries, such as the gd Library, fail when you configure, you can add "-dir" after -- with-gd. RedHatLinux Build LAMP (Linux + Apache + Mysql + PHP) on the platform)I. installation environment:

System platform: Red Hat Linux9, kernel 2.4.20-8, text interface (graphical interface not installed)

Hardware configuration:

CPU: CM 1.8

RAM: 128 MB

DISK: 40 GB

2. software requirements and the following addresses:

1. Apache2.2.6

: Http://apache.mirror.phpchina.com/httpd/httpd-2.2.6.tar.gz

2. Mysql5.0.45

Download the following rpm Package:
MySQL-server-5.0.45-0.i386.rpm
MySQL-devel-5.0.45-0.i386.rpm
MySQL-client-5.0.45-0.i386.rpm
MySQL-shared-5.0.45-0.i386.rpm

:

Server:

Http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-server-5.0.45-0.glibc23.i386.rpm/from/http://mysql.ntu.edu.tw/

Devel:

Http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-devel-5.0.45-0.glibc23.i386.rpm/from/http://mysql.cs.pu.edu.tw/

Client:

Http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-client-5.0.45-0.glibc23.i386.rpm/from/http://mysql.cdpa.nsysu.edu.tw/

Shared:

Http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-shared-5.0.45-0.glibc23.i386.rpm/from/http://mysql.cdpa.nsysu.edu.tw/

In addition, this version is installed with a text interface, it may be missing a perl component: perl-DBI-1.32-5.i386.rpm, when you install Mysql may lack this dependent component. Some people may not be missing, but please remind me...

:

This software is generally used in Red Hat Linux9 3. PHP5.2.4
:

Http://cn.php.net/get/php-5.2.5.tar.bz2/from/hk.php.net/mirror

In addition, if the installed version is PHP5, you need to upgrade the XML library because the built-in version of the system may be low and the configure may fail.

That is to say, to install PHP5, install necessary database support:

Libxml2-2.6.19.tar.gz

: Http://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.19.tar.gz

Libxslt-1.1.15.tar.gz

: Http://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.15.tar.gz

Curl-7.15.0.tar.gz

: Http://curl.haxx.se/download/curl-7.15.0.tar.gz

4. some common library files:

Gd-2.0.33.tar.gz
: Http://www.boutell.com/gd/http/gd-2.0.33.tar.gz

Freetype-2.2.1.tar.gz
: Http://keihanna.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.10.tar.gz

Jpegsrc.v6b.tar.gz
: Http://www.ijg.org/files/jpegsrc.v6b.tar.gz

Libpng-1.2.11.tar.gz
: Http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8.tar.gz

Zlib-1.2.3.tar.gz
: Http://www.zlib.net/zlib-1.2.3.tar.gz

III. installation process:

1. preparations before installation:

Put all the software packages you downloaded in the same folder. in this way, you can install and compare files to facilitate management. For example, I put all the software packages under/usr/local/src. Same.

Here we will first describe the general process, and install Mysql first (I use a command of the rpm software package, the same is true for source code encoding, however, the rmp package and the source code version on the Mysql website are updated almost at the same time, so it is easy to worry about it.) then install the Apache server and complete this process, it is just a library installation file and some miscellaneous things. Finally, install PHP and some final work.

1. install Mysql:

Go to the folder where the downloaded package is located.

# Rpm-ivh Mysql-*. rpm

Or you can install a software package, but it is not easier.

If you are prompted that you lack perl-DBI-1.32-5.i386.rpm support during installation, install it first and find it in the RPMS folder in the second disk of the installation disk.

# Rpm-ivh perl-DBI-1.32-5.i386.rpm

Then: # rpm-ivh Mysql-*. rpm

After the installation is complete, Mysql will start.

Run the following command line:

# Mysql

Mysql> show databases;

+ -------------------- +

| Database |

+ -------------------- +

| Information_schema |

| Mysql |
| Test |

+ -------------------- +

3 rows in set (0.04 sec)

In this case, your Mysql has been installed successfully.

We recommend that you set a password for the Mysql administrator after installing Mysql:

# Mysqladmin-u root password.

2. install Apache

# Tar-zxvf httpd-2.2.6.tar.gz

# Cd httpd-2.2.6/
#./Configure -- prefix =/usr/local/apache -- sysconfdir =/etc/httpd -- enable-so

// Here-prefix specifies that apache installation will be installed in the/usr/local/apache Directory, -- sysconfdir specifies the apache configuration file httpd. install conf in the/etc/httpd directory. (The two paths can be specified at will, but you must remember them during installation, because this path will be used later)

# Make

# Make install

Successful!

Start apache:

#/Usr/local/apache/bin/apachectl start

Enter http: // 127.0.0.1 in the local browser, and press Enter. by default, it works is displayed, proving that apache is in working state.

If there is no graphic interface, enter:

# Lynx http: // 127.0.0.1

The effect is the same. If you want to enable apache to run automatically on the server, perform the following operations:

Edit etc/rc. d/rc. local

# Vi/etc/rc. d/rc. local

Add the following sentence:/usr/local/apache/bin/apachectl start.

Check the installation path of/usr/local/apache here, so remember it clearly when installing it ....

3. install the library software package:

1). JPEG package

# Tar xvzf restart src.v6b.tar.gz

# Cd jpeg-6b

#./Configure

# Mkdir-p/usr/local/man/man1)

# Make

# Make install

# Make install-lib

2). TTF (GD support package)

# Tar xvzf freetype-2.1.10.tar.gz

# Cd free-10

#./Configure

# Make

# Make install

3). zlib package (lib png support package)

# Tar xvzf zlib-1.2.3.tar.gz

# Cd zlib-1.2.3

#./Configure

# Make

# Make install

4). libpng package (zlib package must be installed first)

# Tar xvzf libpng-1.2.8.tar.gz

# Cd libpng-1.2.8

# Cp scrui/makefile. gcmmx makefile)

# Make

# Make install 5). GD package

# Tar xvzf gd-2.0.33.tar.gz

# Cd gd-2.0.33

#./Configure

# Make

# Make install

# Cp gd. h/usr/local/lib/

6). xml package

# Tar xvzf libxml2-2.6.19.tar.gz

# Cd libxml2-2.6.19

#./Configure

# Make

# Make install

7). Libxslt package

# Tar xvzf libxslt-1.1.15.tar.gz

# Cd libxslt-1.1.15.tar.gz

#./Configure

# Make

# Make install

Curl package

# Tat xvzf curl-7.15.0.tar.gz

# Cdcurl-7.15.0

#./Configure

# Make

# Make install

4. PHP installation:

# Tar xvjf php-5.2.5.tar.bz2 (note this is bz2 format !!!!)

# Cd php-5.2.5

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

-- With-apxs2 =/usr/local/apache/bin/apxs

-- With-mysql

-- With-libxml-dir

-- With-png-dir

-- With-jpeg-dir

-- With-zlib

-- With-freetype-dir

-- With-gd

-- With-curl

-- Disable-debug

-- Enable-sockets

-- Enable-force-cgi-redirect

-- With-config-file-path =/etc

-- Enable-magic-quotes

-- Enable-ftp

-- Enable-gd-native-ttf

-With-ttf -- with-gdbm

-- With-gettext

-- With-iconv

-- Enable-mbstring = all

# Make

# Make instal

Tip: If some graphics libraries, such as the gd Library, fail when you configure, you may be able to add "-dir" after -- with-gd. The purpose of this operation is to allow the program to detect its location on its own. Of course, you can specify the location when installing these graphics libraries. PHP has been installed.

5. finishing work:

Edit the apache configuration file httpd. conf.

Vi/etc/httpd. conf

Find "# AddType application/x-gzip. gz. tgz

"

And add

AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps


These two lines aim to enable apache to recognize php.

Find "DirectoryIndex index.html"

Add index. php to make index. php a response page.
6. test environment:

Create a php file under/usr/local/apache/htdocs.

# Vi/usr/local/apache/htdocs/index. php

Input:


Phpinfo ();

?>

Restart apache server

#/Usr/local/apache/bin/apachectl restart

Enter http: // 127.0.0.1/index. php in the browser to test it.

 

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.