lighttpd mysql_lighttpd+mysql+php
博客已經(jīng)搬家,請(qǐng)?jiān)L問(wèn)如下地址:http://www.czhphp.com
一:安裝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
當(dāng)重新啟動(dòng)時(shí)候總 報(bào)以下錯(cuò)誤:
ERROR! MySQL manager or server PID file could not be found!
Starting MySQL. ERROR! Manager of pid-file quit without updating file.
解決辦法:
MySQL編譯安裝,初始化數(shù)據(jù)庫(kù)的時(shí)候出現(xiàn):
unknown option ‘–skip-federated’ 錯(cuò)誤。
#vi /etc/my.cnf
#skip-federated 將此行注釋掉即可?;蛘呔幾g的時(shí)候加上如下參數(shù):–with-plugins=all
如果還是不行的話那么就是因?yàn)槟谂渲玫臅r(shí)候沒(méi)有添加datadir,
#vi /etc/my.cnf
添加以下語(yǔ)句:
[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安裝的過(guò)程中也許會(huì)報(bào)以下錯(cuò)誤
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
解決辦法:
請(qǐng)安裝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
執(zhí)行安裝完以后即可解決問(wèn)題
make
make install
復(fù)制參數(shù)文件到目標(biāo)目錄:
cp php.ini-dist /usr/local/php-fcgi/lib/php.ini
檢查fast-cgi是否安裝成功可以運(yùn)行如下命令
/usr/local/php-fcgi/bin/php-cgi -v
顯示如下信息,內(nèi)容里包含“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
早就聽(tīng)說(shuō)lighttpd加PHP的FAST-CGI方式性能不錯(cuò),抽時(shí)間裝了下.只是完成了環(huán)境的安裝,還沒(méi)具體看性能什么的!
以下是我裝lighttpd+PHP(FAST-CGI)+mysql的,如有問(wèn)題,請(qǐng)給我評(píng)論.
三、最后安裝lighttpd
1.安裝配置lighttpd
1.1 首先創(chuàng)建運(yùn)行l(wèi)ighttpd的用戶和組
# groupadd lighttpd
# useradd -g lighttpd -s /sbin/nologin -d /dev/null lighttpd
1.2 開(kāi)始安裝lighttpd
# 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” =>
( “l(fā)ocalhost” =>
( “socket” => “/var/run/lighttpd/php-fastcgi.socket”,
“bin-path” => “/usr/local/php-fcgi/bin/php-cgi” )
)
)
/var/run/lighttpd 該目錄需要?jiǎng)?chuàng)建如果沒(méi)有的話
一開(kāi)始我把配置寫(xiě)”bin-path” => “/usr/local/php-fcgi/bin/php”這樣,發(fā)現(xiàn)報(bào)錯(cuò),后來(lái)改了下以上的配置,發(fā)現(xiàn)OK了!
啟動(dòng)lighttpd命令是這樣的:
chown -R lighttpd:lighttpd /usr/local/lighttpd
service lighttpd restart
PHP FastCGI環(huán)境測(cè)試 —
echo “” > /usr/local/lighttpd/htdocs/index.php
curl http://127.0.0.1/index.php
大概的安裝過(guò)程如上,有什么問(wèn)題請(qǐng)大家多多指教,歡迎大家留下寶貴意見(jiàn),謝謝。
總結(jié)
以上是生活随笔為你收集整理的lighttpd mysql_lighttpd+mysql+php的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 用零信任保护代码安全安全 零信任
- 下一篇: 老师反应亮了我对老师有了反应