lighttpd+php (fast-cgi) +mysql's study notes _php tutorial

Source: Internet
Author: User
I have heard that lighttpd plus PHP fast-cgi way performance is good, take time to install the next. Just finished the installation of the environment, have not specifically looked at the performance or anything!

The following is I installed lighttpd+php (fast-cgi) +mysql, if there is a problem, please give me comments.



First, install MySQL

Install MySQL, you can install the source package, you can also compile the good! Direct decompression of the copy is also OK. I'm using a direct copy of the build!

1. Compiling the source package

./configure--prefix=/data2/ali--enable-assembler--enable-thread-safe-client--without-debug

Make

Make install

2. Use the compiled compression pack! Directly unzip the copy

Tar zxf mysql-standard-5.0.27-linux-i686-glibc23.tar.gz

CD mysql-standard-5.0.27-linux-i686-glibc23

CP-RF Mysql-standard-5.0.27-linux-i686-glibc23/usr/local/mysql


The following is to start multiple ports

Mkdir-p/data2/ali/mysql3308

Mkdir-p/data2/ali/mysql3309

./scripts/mysql_install_db--ldata=/data2/ali/mysql3308

CP SUPPORT-FILES/MY-MEDIUM.CNF/DATA2/ALI/MYSQL3308/MY.CNF

Vi/data2/ali/mysql3308/my.cnf

The contents of the amendment are as follows:

#

[Mysqld]

DataDir =/data2/ali/mysql3308/

Port = 3308

Socket =/tmp/mysql-3308.sock

#


cp/data2/ali/mysql3308//data2/ali/mysql3309/

Vi/data2/ali/mysql3309/my.cnf

The contents of the amendment are as follows:

#

[Mysqld]

DataDir =/data2/ali/mysql3309/

Port = 3309

Socket =/tmp/mysql-3309.sock

#

Start MySQL

/usr/local/mysql/bin/mysqld_safe--defaults-file=/data2/ali/mysql3308/my.cnf--user=root &

/usr/local/mysql/bin/mysqld_safe--defaults-file=/data2/ali/mysql3309/my.cnf--user=root &


Check if MySQL started successfully.

Ps-ax|grep MySQL

20835 pts/3 S 0:00/bin/sh./mysqld_safe--defaults-file=/data2/ali/mysql3308/my.cnf--user=root

20862 PTS/3 Sl 0:00/usr/local/mysql/bin/mysqld--defaults-file=/data2/ali/mysql3308/my.cnf--basedir=/usr/local/ MySQL--datadir=/data2/ali/mysql3308/--user=root--pid-file=/data2/ali/mysql3308//xd_blog_web_132_42.pid-- Skip-external-locking--port=3308--socket=/tmp/mysql-3308.sock

20872 pts/3 S 0:00/bin/sh./mysqld_safe--defaults-file=/data2/ali/mysql3309/my.cnf--user=root

20903 PTS/3 Sl 0:00/usr/local/mysql/bin/mysqld--defaults-file=/data2/ali/mysql3309/my.cnf--basedir=/usr/local/ MySQL--datadir=/data2/ali/mysql3309/--user=root--pid-file=/data2/ali/mysql3309//xd_blog_web_132_42.pid-- Skip-external-locking--port=3309--socket=/tmp/mysql-3309.sock


Connect to MySQL

Mysql-s/tmp/mysql-3108.sock




Second, then install PHP

Tar zxf php-5.2.4.tar.gz

CD php-5.2.4

./configure \

--PREFIX=/USR/LOCAL/PHP-FCGI \

--ENABLE-FASTCGI \

--enable-force-cgi-redirect \

--without-iconv \

--enable-mbstring \

--with-mysql=/usr/local/mysql

Make

Make install


Copy the parameter file to the destination directory:

CP Php.ini-dist/usr/local/php-fcgi/lib/php.ini


Check that the fast-cgi is installed successfully can run the following command

/usr/local/php-fcgi/bin/php-cgi-v

The following information is displayed, including "PHP 5.2.4 (cgi-fcgi)", which indicates support for fast-cgi.

PHP 5.2.4 (cgi-fcgi) (built:oct 28 2007 20:08:41)

Copyright (c) 1997-2007 the PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies



Third, the final installation of LIGHTTPD

1. Installation Configuration lighttpd


1.1 First create the users and groups running LIGHTTPD


# Groupadd LIGHTTPD

# useradd-g lighttpd-s/sbin/nologin-d/dev/null lighttpd


1.2 Starting the installation of LIGHTTPD


# wget http://www.lighttpd.net/download/lighttpd-1.4.8.tar.gz

# TAR-ZXVF Lighttpd-1.4.8.tar.gz

# CD lighttpd-1.4.8

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


# make

# make Install


# mkdir/usr/local/lighttpd/conf

# Mkdir/usr/local/lighttpd/log


# mv./doc/lighttpd.conf/usr/local/lighttpd/conf/

# CP./doc/rc.lighttpd.redhat/etc/init.d/lighttpd




VI conf/lighttpd.conf

# Remove the # "mod_fastcgi", #

Server.modules = (

"Mod_rewrite",

"Mod_redirect",

# "Mod_alias",

"Mod_access",

# "MOD_CML",

# "MOD_TRIGGER_B4_DL",

# "Mod_auth",

# "Mod_status",

# "Mod_setenv",

"Mod_fastcgi",


Find the definition of fastcgi


# # # FASTCGI Module

# # Read Fastcgi.txt for more info

# # for PHP don ' t forget to set Cgi.fix_pathinfo = 1 in the php.ini

Fastcgi.server = (". php" =

("localhost" =

(

"Socket" = "/var/run/lighttpd/php-fastcgi.socket",

"Bin-path" = "/usr/local/php-fcgi/bin/php-cgi"

)

)

)


At first I put the configuration write "Bin-path" and "/usr/local/php-fcgi/bin/php" so, found the error, and later changed the above configuration, found OK!

The start lighttpd command is this:

/usr/local/lighttpd/sbin/lighttpd-f conf/lighttpd.conf


Finally, you can build a test.php in the program directory, check whether it is normal!

http://www.bkjia.com/PHPjc/364048.html www.bkjia.com true http://www.bkjia.com/PHPjc/364048.html techarticle I have heard that lighttpd plus PHP fast-cgi way performance is good, take time to install the next. Just finished the installation of the environment, have not specifically looked at the performance or anything! Here are my lighttpd+php (fast-cgi) +mysql ...

  • 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.