Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The configuration method of Apache+Mysql+Php under RedHat Enterprise Linux 5

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the configuration method of Apache+Mysql+Php under RedHat Enterprise Linux 5". In the daily operation, I believe that many people have doubts about the configuration method of Apache+Mysql+Php under RedHat Enterprise Linux 5. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "the configuration method of Apache+Mysql+Php under RedHat Enterprise Linux 5". Next, please follow the editor to study!

The first step: preparation of system and software

System version redhat enterprise linux 5, kernel version 2.6.18

Selection of system installation components: GNOME, graphical Internet, editor, development tools, basic systems, system tools, management tools, X window environment

(because the machine is limited, it needs to be tested locally, so install GNOME and Internet environment.)

Step 2: preparation of the software package

Httpd package: httpd-2.2.8.tar.bz2

The mysql package was downloaded from the official website of mysql. I chose ehel5's rpm package.

MySQL-server-community-5.0.51a-0.rhel5.i386.rpm

MySQL-client-community-5.0.51a-0.rhel5.i386.rpm

MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm

MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm

Php5 package: php-5.2.5.tar.bz2

Other library files:

Curl-7.15.0.tar.gz

Freetype-2.3.5.tar.gz

Gd-2.0.35.tar.gz

Jpegsrc.v6b.tar.gz

Libpng-1.2.26.tar.gz

Libxml2-2.6.31.tar.gz

PDFlib-7.0.3-Linux-php.tar.gz

T1lib-5.0.0.tar.gz

Xpm-3.4k.tar.gz

Zlib-1.2.3.tar.gz

Gettext-0.16.tar.gz

Other management packages:

PhpMyAdmin-2.11.6-rc1-all-languages.tar.gz

Webmin-1.410.tar.gz

The third step is to start the installation: the order of installation, the installation of httpd and mysql, it doesn't matter from this environment, but if you want to install the php5 package finally, install httpd first.

The brief steps are as follows, followed by a command at the # prompt to copy all the packages to one location. Here, I create the lamp directory under the / usr/local/src directory, and then copy all the packages to the lamp.

# cd / usr/local/src/lamp

# tar zxvf httpd-2.2.8.tar.bz2

# cd http-2.2.8

#. / configure-prefix=/usr/local/apache2-enable-rule=SHARED_CORE-enable-module=so

# make

# make install

Installation of apache is complete, enter command

# / usr/local/apache2/bin/apachectl-k start

Open a Firefox browser from your local or other machine (my favorite), enter the address http:// your server ip address, and remember to open port 80 of the server, otherwise an error may be prompted, and a "It works!" will appear if correct. At this point, the apache2 installation is almost complete.

Next for Mysql installation, I first install the mysql-server installation package, prompting the need for perl-DBI package, from the installation CD can be found, DVD installation directly to the Server folder on the CD to find it, if it is cd installation, go to cd-2 on the same directory.

# mount / dev/cdrw / media

# rpm-ivh / media/Server/perl-DBI-1.52-1.fc6.i386.rpm

Install the other packages of mysql after the installation is complete

# rpm-Uvh MySQL-server-community-5.0.51a-0.rhel5.i386.rpm

# rpm-Uvh MySQL-client-community-5.0.51a-0.rhel5.i386.rpm

# rpm-Uvh MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm

# rpm-Uvh MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm

Change the root password of mysql after installation. Default is empty. Modify command is as follows

# / usr/bin/mysqladmin-u root password 'password string'

If you log in to mysql from the command line later, enter

# mysql-u root-p

You will be prompted for a password and the basic installation of Mysql is complete.

The next step is the installation of other library files, which should be optional (zlib is installed before libpng), but I think you can install Zlib first for reference only.

This time, I didn't install zlib first, so I randomly chose to install it, first Curl.

# tar zxvf curl-7.15.0.tar.gz

# cd curl-7.15.0

#. / configure-prefix=/usr/local/curl

(I think I can add-- with-zlib switch, but this time I didn't use it.)

# make

# make install

For the installation of jpeg, jpeg cannot create the directory required for the installation. It should be created in advance.

# mkdir-pv / usr/local/jpeg/ {, bin,lib,include,man/man1,man1}

#. / configure-prefix=/usr/local/jpeg-enable-shared-enable-static

# make

# make install

Installation of libxml2

# tar zxvf libxml2-2.6.31.tar.gz

# cd libxml2

#. / configure-prefix=/usr/local/libxml2

(you can try turning on the zlib switch,-- with-zlib)

# make (it may take a little longer)

# make install

# cp xml2-config / usr/bin

Installation of LibPDF

# tar zxvf PDFlib-7.0.3-Linux-php.tar.gz

# cd pdflib

# cp bind/php5/php520mt/libpdf-php.so / usr/local/lib/

(there is a php503,php510,php520 directory in the sibling directory of the php520mt directory above. I don't know if it is different from the version.)

Installation of T1lib

# tar zxvf t1lib-5.0.0.tar.gz

# cd t1lib

#. / configure-prefix=/usr/local/t1lib

# make without-doc

# make install

Installation of Freetype

# tar zxvf freetype-2.3.5.tar.gz

# cd freetype

#. / configure-prefix=/usr/local/freetype

# make

# make install

Installation of Zlib

# tar zxvf zlib-1.2.3.tar.gz

#. / configure-shared

# make

# make install

Installation of Libpng

# tar zxvf libpng-1.2.26.tar.gz

# cd libpng

# cp scripts/makefile.linux. / makefile

#. / configure-prefix=/usr/local/libpng

# make

# make install

For the installation of GDlib, there may be an error message for AM_ICON. You need to install the gettext package at this time.

# tar zxvf gettext-0.16.tar.gz

# cd gettext

#. / configure-prefix=/usr/local/gettext

# make

# make install (a little longer)

Next is the installation of gdlib

# tar zxvf gd-2.0.35.tar.gz

# cd gd

#. / configure-with-png=/usr/local/lib\

-- with-zlib=/usr/local/lib\

-- with-freetype=/usr/local/freetype/lib\

-- with-jpeg=/usr/local/jpeg/lib

# make

# make install

Installation of PHP5

# tar zxvf php-5.2.5.tar.bz2

# cd php

#. / configure-prefix=/usr/local/php-with-apxs2=/usr/local/apache/bin/apxs\

-enable-track-vars-- with-sockets-- enable-sockets-- with-sysvshm-- with-sysvsem\

-- with-pdflib-dir=/usr/local/lib-- with-jpeg-dir=/usr/local/jpeg\

-- with-png-dir=/usr/local/lib-- with-zlib-dir=/usr/local/lib\

-- with-freetype-dir=/usr/local/freetype-- with-curl=/usr/local/curl\

-- with-libxml-dir=/usr/locallibxml2/lib-- with-t1lib=/usr/localt1lib\

-with-gettext=/usr/localgettext/lib-with-gd-with-mysql

(it's better to add mbstring and mcypt. I don't know if it's necessary.)

If successful after configure, it will prompt PHP welcome interface: Thank you for using PHP.

# make

# make test

(about 3000 tests)

# make install

Modification of Php.ini file

# cp php.ini.dist / usr/local/lib/

Find and modify the contents of extension_dir='./'

Extension_dir = / usr/local/lib

Extension=libpdf_php.so

Save exit

Finally, modify the apache configuration file httpd.conf

# vi / usr/local/apache2/conf/httpd.conf

Find AddType at about DefaultType text/plain

Enter the following

AddType application/x-httpd-php .htm

AddType application/x-httpd-php .html

AddType application/x-httpd-php .phtml

AddType application/x-httpd-php .php

AddType application/x-httpd-php .php3

AddType application/x-httpd-php .php4

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

(it is not clear whether it is necessary to enter so many items)

Find DirectoryIndex index.html and enter index.php after that

Save the file and exit.

Test php, create an info.php file and put it in the directory of the website. Here is / usr/local/apapche2/htdocs

The contents are as follows

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report