Install LAMP in source code, use PHP in Module mode, and use xcache 2.0.0 to accelerate PHP

Source: Internet
Author: User
Tags mcrypt

Introduction to LAMP

The LAMP (Linux-Apache-MySQL-PHP) website architecture is currently a popular Web framework, including: Linux operating system, Apache network server, MySQL database, perl, PHP, or Python programming language. All components are open-source software and are internationally mature architecture frameworks. Many popular commercial applications adopt this architecture. Compared with the Java/J2EE architecture, LAMP features rich Web resources, lightweight, and fast development. compared with the NET architecture, LAMP has the advantages of common, cross-platform, high performance and low price. Therefore, LAMP is the preferred platform for enterprises to build websites, regardless of its performance, quality, and price.
First, the installation sequence is apache ---> mysql ---> php
Environment: RHEL5.8 I386
Development Libraries
Development Tools


Software Package: httpd: 2.4.4
Php: 5.4.13
MySQL: 5.6.10 universal Binary Package


Preparation:
Make sure that the lamp environment is not installed on your system, such as mysql, httpd, and php.


Install

Installation of apache2.4

Apr-utils is a newer version because apache2.4 requires apr. Here we use the source code package for compilation and installation.
Apr-1.4.6.tar.gz
Apr-util-1.4.1.tar.gz
Tar xf apr-util-1.4.1.tar.gz & tar xf apr-1.4.6.tar.gz
Cd apr-1.4.6
./Configure -- prefix =/usr/local/apr
Make & make install
Cd./apr-util-1.4.1
./Cofigure -- prefix =/usr/local/apr-utils -- with-apr =/usr/local/apr
Make & make install


Tar xf httpd-2.4.4.tar.bz2
Cd httpd-2.4.4
. /Configure -- prefix =/usr/local/apache -- sysconfdir =/etc/httpd -- enable-so -- enable-rewirte -- enable-ssl -- enable-cgi -- enable-cgid -- enable -modules = most -- enable-mod-shared = most -- enable-mpms-shared = all -- with-apr =/usr/local/apr -- with-apr-util =/usr /local/apr-util
Make & make install
To facilitate future use, make the sysV Service Startup Script:
In general, if it is manually compiled, apache does not start the script, that is, you cannot use the simple/etc/init. d/httpd (start | stop | restart) to start/Close/restart. In fact, there is a STARTUP script in the source code. We need to modify it and add Apache to the SysV service of the system.
The httpd. init Copy command in the source code httpd-2.x.x/build/rpm is as follows:
Cp httpd. init/etc/init. d/httpd
After the copy, note that there are three main points to be modified:
Httpd =$ {HTTPD-/usr/local/apache/bin/httpd}

Pidfile =$ {PIDFILE-/usr/local/apache/logs/$ {prog}. pid}

CONFFILE =/usr/local/apache/conf/httpd. conf

Change the path based on your actual situation!

Run the following command:

Chmod + x/etc/init. d/httpd

Chkconfig -- add httpd

Chkconfig -- level2345 httpd on

In this way, you can start, stop, and restart Apache in the following ways:

/Etc/init. d/httpdstart

/Etc/init. d/httpdstop

/Etc/init. d/httpdrestart
Output PATH variable
Vim/etc/profile. d/httpd. sh
Export PATH = $ PATH:/usr/local/apache/bin

 


Install mysql


Tar xvf mysql-5.5.28-linux2.6-i686.tar.gz
Music mysql-5.5.28-linux2.6-i686/usr/local
Ln-s mysql-5.5.28-linux2.6-i686/usr/local/mysql
Note: The above are officially required
Useradd-r mysql
Cp support-files/my-large.cnf/etc/my. cnf
Chown-R mysql: mysql.
Scripts/mysql_install_db -- user = mysql
NOTE: If your data is not stored in the default file system, you can add -- datadir =/data/db
If you modify the default directory, You need to modify the/etc/my. cnf file.
Add under mysqld
Datadir =/data/db
Chown-R root: mysql.
Chown-R mysql: mysql/data/db
Chmod-R 750.
Cp support-files/mysql. server/etc/init. d/mysqld
Mysql command tool
Vim/etc/profile. d/mysqld. sh
Export PATH = $ PATH:/usr/local/mysql/bin


Man manual settings
Vim/etc/man. config
Add a row:
MANPATH/usr/local/mysql/man
Lib Library File Settings
Vim/etc/ld. so. conf. d/mysql. conf
Add a row:
/Usr/local/mysql/lib
Reload the system library file
Lddconfig-v
Include header file settings
Ln-s/usr/local/mysql/include/usr/include/mysql


Install php

Tar xvf php-5.4.13.tar.bz2
Cd php-5.4.13
. /Configure -- prefix =/usr/local/php -- with-mysql =/usr/local/mysql -- with-openssl -- with-mysqli =/usr/local/mysql/bin/ mysql_config -- enable-mbstring -- with-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib -- with-libxml-dir =/usr -- enable-xml -- enable-sockets -- with-apxs2 =/usr/local/apache/bin/apxs -- with-mcrypt -- with-config-file-scan-dir =/etc/php. d -- with-bz2 -- enable-maintainer-zts
An error is reported during installation:
Configure: error: mcrypt. h not found. Please reinstall libmcrypt.

We need to install the required software package for the encrypted Library:
Rpm-ivh mhash-devel-0.9.2-6.el5.i386.rpm mhash-0.9.2-6.el5.i386.rpm libmcrypt-devel-2.5.7-5.el5.i386.rpm libmcrypt-2.5.7-5.el5.i386.rpm
Make & make install
Php installation is complete.

Recommended reading:

Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04

Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)

Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind

Build a WEB Server Linux + Apache + MySQL + PHP in the LAMP source code Environment

  • 1
  • 2
  • Next Page

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.