lighttpd mysql_lighttpd+mysql+php | 学步园

一:安装mysql

安装:

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

当重新启动时候总 报以下错误:

ERROR! MySQL manager or server PID file could not be found!

Starting MySQL. ERROR! Manager of pid-file quit without updating file.

解决办法:

MySQL编译安装,初始化数据库的时候出现:

unknown option '--skip-federated' 错误。

#vi /etc/my.cnf

#skip-federated 将此行注释掉即可。或者编译的时候加上如下参数:--with-plugins=all

如果还是不行的话那么就是因为您在配置的时候没有添加datadir,

#vi /etc/my.cnf

添加以下语句:

[mysqld]

port            = 3306

socket          = /tmp/mysql.sock

datadir = /usr/local/mysql/data

datadir是新加的

二、接着安装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

注意:php安装的过程中也许会报以下错误

collect2: ld returned 1 exit status

make: *** [sapi/cgi/php-cgi] Error 1

解决办法:

请安装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

执行安装完以后即可解决问题

make

make install

复制参数文件到目标目录:

cp php.ini-dist /usr/local/php-fcgi/lib/php.ini

检查fast-cgi是否安装成功可以运行如下命令

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

显示如下信息,内容里包含“PHP 5.2.4 (cgi-fcgi)"表示支持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

早就听说lighttpd加PHP的FAST-CGI方式性能不错,抽时间装了下.只是完成了环境的安装,还没具体看性能什么的!

以下是我装lighttpd+PHP(FAST-CGI)+mysql的,如有问题,请给我评论.

三、最后安装lighttpd

1.安装配置lighttpd

1.1 首先创建运行lighttpd的用户和组

# groupadd lighttpd

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

1.2 开始安装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

将 #”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 take look at the

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

找到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 该目录需要创建如果没有的话

一开始我把配置写"bin-path" => "/usr/local/php-fcgi/bin/php"这样,发现报错,后来改了下以上的配置,发现OK了!

启动lighttpd命令是这样的:

chown -R lighttpd:lighttpd /usr/local/lighttpd

service lighttpd restart

PHP FastCGI环境测试 --

echo "<?php phpinfo(); ?>" > /usr/local/lighttpd/htdocs/index.php

大概的安装过程如上,有什么问题请大家多多指教,欢迎大家留下宝贵意见,谢谢。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值