lighttpd+mysql+php

Source: Internet
Author: User
Blog has moved, please visit the following address: http://www.czhphp.com

One: Install MySQL

Download: wget http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.1.33.zip

Installation:

Unzip Mysql-5.1.33.zip

CD Mysql-5.1.33.zip

./configure--prefix=/usr/local/mysql--enable-assembler--with-extra-charsets=complex--enable-thread-safe-client --with-big-tables--with-readline--with-ssl--with-embedded-server--enable-local-infile--with-plugins=innobase
Make
Make install
Useradd mysql-d/data/mysql-s/sbin/nologin
/usr/local/mysql/bin/mysql_install_db--user=mysql
Cd/usr/local/mysql
Chown-r Root:mysql.
Mkdir-p/data/mysql/data
Chown-r Mysql/data/mysql/data
CP SHARE/MYSQL/MY-HUGE.CNF/ETC/MY.CNF
CP Share/mysql/mysql.server/etc/rc.d/init.d/mysqld
chmod 755/etc/rc.d/init.d/mysqld
Chkconfig--add MySQL

Service mysqld Start

The following error is always reported when restarting:

error! MySQL Manager or server PID file could not being found!

Starting MySQL. error! Manager of Pid-file quit without updating file.

Workaround:

MySQL compiles the installation, when initializing the database appears:
Unknown option '--skip-federated ' ERROR.

#vi/etc/my.cnf
#skip-federated comment out the line. or compile with the following parameters:--with-plugins=all

If it doesn't work, then it's because you didn't add datadir when you configured it,

#vi/etc/my.cnf

Add the following statement:

[Mysqld]
Port = 3306
Socket =/tmp/mysql.sock
DataDir =/usr/local/mysql/data
DataDir is a new addition.

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

Note: The following error may be reported during the installation of PHP

Collect2:ld returned 1 exit status
Make: * * * [sapi/cgi/php-cgi] Error 1

Workaround:

Please install the installation package required by Lib

Yum install NTP vim-enhanced gcc gcc-c++ gcc-g77 Flex Bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg -devel libpng-devel libtiff-devel freetype-devel libxpm-devel gettext-devel pam-devel kernel

Solve the problem after you perform the installation

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

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.

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

# Mkdir/usr/local/lighttpd/htdocs

# 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",
# "Mod_proxy",
# "Mod_simple_vhost",
"Mod_evhost",
# "Mod_userdir",
# "mod_cgi",
# "Mod_compress",
# "Mod_ssi",
# "Mod_usertrack",
# "Mod_expire",
# "Mod_secdownload",
# "Mod_rrdtool",
"Mod_accesslog")

# # A static document-root, for virtual-hosting
# # Server.virtual-* Options
Server.document-root = "/usr/local/lighttpd/htdocs/"

# # Where to send Error-messages to
Server.errorlog = "/usr/local/lighttpd/log/lighttpd/error.log"

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")

)

)

/VAR/RUN/LIGHTTPD the directory needs to be created if not
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:

Chown-r lighttpd:lighttpd/usr/local/lighttpd

Service LIGHTTPD Restart

PHP fastcgi Environment Test--

echo " " >/usr/local/lighttpd/htdocs/index.php

Curl http://127.0.0.1/index.php

Approximate installation process As above, there are any questions please advise, welcome to leave valuable comments, thank you.

Blog has moved, please visit the following address: http://www.czhphp.com

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