Lamp platform, MySQL, httpd, PHP installation

Source: Internet
Author: User
Tags bz2 install php zts


Lamp Platform


Compile and install Apache to resolve dependencies


Install Apr

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/45/CC/wKiom1PrZ9azyD6HAAez2YRGquo172.jpg "title=" Compile and install apr.png "alt=" Wkiom1prz9azyd6haaez2yrgquo172.jpg "/>




Compiling and installing Apr-util

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/45/CC/wKiom1PraMrCDxfzAALx1cJ5h7k838.jpg "title=" image 002. PNG "alt=" wkiom1pramrcdxfzaalx1cj5h7k838.jpg "/>


Install the Pcre-devel package.

Use the command yum install pcre-devel-y



Compiling and installing httpd-2.4.9


# Tar XF httpd-2.4.9.tar.bz2

# CD httpd-2.4.9

#./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd2.4--enable-so--enable-ssl--enable-cgi-- Enable-rewrite--with-zlib--with-pcre--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util-- Enable-modules=most--enable-mpms-shared=all--with-mpm=event

# Make && make install




Add:

1. Build MPM as static module

In all platforms, MPM can be built as a static module. Select a mpm at build time, linked to the server. If you want to change MPM, you must rebuild it. In order to use the specified MPM, use the parameter--with-mpm=name when executing the Configure script. Name is the specified MPM name. After the compilation is complete, you can use./httpd-l to determine the selected MPM. This command lists all modules that are compiled into the server program, including MPM.


2. Build MPM as dynamic module


In UNIX or similar platforms, MPM can be built as a dynamic module and loaded at run time as with other dynamic modules. Building MPM as a dynamic module allows you to change the MPM by modifying the contents of the LoadModule directive without rebuilding the server program. Use the--enable-mpms-shared option to enable this feature when you execute a configure script. All MPM modules supported by this platform will be installed when the given parameter is all. You can also give a list of modules in the parameters. The default MPM, which can be automatically selected or specified by the--WITH-MPM option when the Configure script is executed, then appears in the generated server configuration file. Edit the loadmodule instruction content to select a different mpm.


3. Modify the main configuration file of httpd and set the path of its PID file.

To edit the/etc/httpd/httpd.conf, add the following line:

Pidfile "/var/run/httpd.pid"


4, provide SYSV service script/etc/rc.d/init.d/httpd, the content is as follows:


#!/bin/bash

#

# httpd Startup script for the Apache HTTP Server

#

# Chkconfig:-85 15

# Description:apache is a world Wide Web server. It's used to serve \

# HTML files and CGI.

# PROCESSNAME:HTTPD

# config:/etc/httpd/conf/httpd.conf

# config:/etc/sysconfig/httpd

# Pidfile:/var/run/httpd.pid


# Source function library.

. /etc/rc.d/init.d/functions


if [-F/ETC/SYSCONFIG/HTTPD]; Then

. /etc/sysconfig/httpd

Fi


# Start httpd in the C locale by default.

httpd_lang=${httpd_lang-"C"}


# This would prevent Initlog from swallowing up a pass-phrase prompt if

# Mod_ssl needs a pass-phrase from the user.

Initlog_args= ""


# Set Httpd=/usr/sbin/httpd.worker in/etc/sysconfig/httpd to use a server

# with the thread-based "worker" MPM; Be warned this some modules may not

# work correctly with a thread-based MPM; Notably PHP would refuse to start.


# Path to the Apachectl script, server binary, and short-form for messages.

Apachectl=/usr/local/apache/bin/apachectl

HTTPD=${HTTPD-/USR/LOCAL/APACHE/BIN/HTTPD}

Prog=httpd

Pidfile=${pidfile-/var/run/httpd.pid}

LOCKFILE=${LOCKFILE-/VAR/LOCK/SUBSYS/HTTPD}

Retval=0


Start () {

Echo-n $ "Starting $prog:"

lang= $HTTPD _lang Daemon--pidfile=${pidfile} $httpd $OPTIONS

Retval=$?

Echo

[$RETVAL = 0] && Touch ${lockfile}

Return $RETVAL

}


Stop () {

Echo-n $ "Stopping $prog:"

Killproc-p ${pidfile}-D $httpd

Retval=$?

Echo

[$RETVAL = 0] && rm-f ${lockfile} ${pidfile}

}

Reload () {

Echo-n $ "Reloading $prog:"

if! lang= $HTTPD _lang $httpd $OPTIONS-T >&/dev/null; Then

Retval=$?

echo $ "not reloading due to configuration syntax error"

Failure $ "not reloading $HTTPD due to configuration syntax error"

Else

Killproc-p ${pidfile} $httpd-hup

Retval=$?

Fi

Echo

}


# See how we were called.

Case "$" in

Start

Start

;;

Stop

Stop

;;

Status

Status-p ${pidfile} $httpd

Retval=$?

;;

Restart

Stop

Start

;;

Condrestart)

If [-f ${pidfile}]; Then

Stop

Start

Fi

;;

Reload

Reload

;;

Graceful|help|configtest|fullstatus)

$apachectl [email protected]

Retval=$?

;;

*)

echo $ "Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"

Exit 1

Esac


Exit $RETVAL



Give execute permission to this script:

# chmod +X/ETC/RC.D/INIT.D/HTTPD


Join the Service list:

# chkconfig--add httpd




Installing MySQL-5.5.33

1. Prepare the file system for data storage


Create a new logical volume and mount it to a specific directory. The process is no longer given here.


This assumes that the mounted directory of its logical volume is/mydata, and then needs to create the/mydata/data directory as the storage directory for MySQL data.


2. The new user runs the process in a secure manner:


# groupadd-r MySQL

# useradd-g mysql-r-s/sbin/nologin-m-d/mydata/data MySQL

# Chown-r Mysql:mysql/mydata/data


3. Install and initialize the mysql-5.5.33

# Tar XF mysql-5.5.33-linux2.6-i686.tar.gz-c/usr/local

# cd/usr/local/

# LN-SV mysql-5.5.33-linux2.6-i686 MySQL

# CD MySQL


# Chown-r Mysql:mysql.

# scripts/mysql_install_db--user=mysql--datadir=/mydata/data

# Chown-r Root.


4. Provide the main configuration file for MySQL:


# Cd/usr/local/mysql

# CP SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF


and modify the value of thread_concurrency in this file to multiply your number of CPUs by 2, for example using the following line:

Thread_concurrency = 2


Also add the following line to specify where the MySQL data file will be stored:

DataDir =/mydata/data


5. Provide SYSV service script for MySQL:


# Cd/usr/local/mysql

# CP Support-files/mysql.server/etc/rc.d/init.d/mysqld

# chmod +x/etc/rc.d/init.d/mysqld


Add to Service list:

# chkconfig--add mysqld

# Chkconfig Mysqld on


6, output the MySQL man manual to the man command to find the path:


To edit the/etc/man.config, add the following line:

Manpath/usr/local/mysql/man


7, output MySQL header file to the System header file path/usr/include:


This can be achieved by simply creating a link:

# Ln-sv/usr/local/mysql/include/usr/include/mysql


8. Output MySQL library file to the system library to find the path:


# echo '/usr/local/mysql/lib ' >/etc/ld.so.conf.d/mysql.conf


The system is then re-loaded into the system library:

# Ldconfig


9, modify the PATH environment variable, so that the system can directly use MySQL related commands. The concrete implementation process is no longer given here.




Compiling and installing php-5.4.26


1, to resolve the dependency relationship:


After configuring the Yum source (System installation source and Epel source), execute the following command:

# yum-y Groupinstall "Desktop Platform Development"

# yum-y Install Bzip2-devel Libmcrypt-devel



2. Compile and install php-5.4.26


First download the source package to the local directory, download location ftp://172.16.0.1/pub/Sources/new_lamp.


# Tar XF php-5.4.26.tar.bz2

# CD php-5.4.26

#./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-path=/ etc--WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2--enable-maintainer-zts


Description

1. In order to support the two mpm of the Apache worker or event, the--ENABLE-MAINTAINER-ZTS option is used at compile time.

2, if you use PHP5.3 or above, in order to link the MySQL database, you can specify MYSQLND, so you do not need to install the MySQL or MySQL development package. MYSQLND is available from PHP 5.3 and can be bound to it at compile time (instead of relying on the specific MySQL client library bindings), but it is the default setting starting with PHP 5.4.

#./configure--with-mysql=mysqlnd--with-pdo-mysql=mysqlnd--with-mysqli=mysqlnd


# make

# Make Test

# Make Intall


To provide a configuration file for PHP:

# CP Php.ini-production/etc/php.ini


3, edit Apache configuration file httpd.conf, with Apache support PHP

# vim/etc/httpd/httpd.conf

1, add the following two lines

AddType application/x-httpd-php. php

AddType Application/x-httpd-php-source. Phps


2. Locate to DirectoryIndex index.html

Modified to:

DirectoryIndex index.php index.html



Restart httpd. Detects if PHP is working properly.


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/CD/wKiom1PrcfOw0w4PAAChNYT6wC8300.jpg "title=" Qq20140813220925.png "alt=" Wkiom1prcfow0w4paachnyt6wc8300.jpg "/>


Install XCache for PHP acceleration:


1. Installation

# Tar XF xcache-3.0.3.tar.gz

# CD xcache-3.0.3

#/usr/local/php/bin/phpize

#./configure--enable-xcache--with-php-config=/usr/local/php/bin/php-config

# Make && make install


At the end of the installation, a line similar to the following appears:

Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-zts-20100525/


2, edit php.ini, integrate PHP and XCache:


The sample configuration provided by XCache is first imported into the php.ini

# MKDIR/ETC/PHP.D

# CP XCACHE.INI/ETC/PHP.D


Description: The Xcache.ini file is in the XCache source directory.


Next edit/etc/php.d/xcache.ini, locate the line that begins with zend_extension, and modify it to the following line:

Zend_extension =/usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/45/CE/wKioL1PrdArTUWWgAAXgAI_QdR8428.jpg "title=" image 059. PNG "alt=" wkiol1prdartuwwgaaxgai_qdr8428.jpg "/>

This article is from the "Regular Expressions" blog, so be sure to keep this source http://hhxxb.blog.51cto.com/9152570/1539715

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.