FreeBSD Lighttpd PHP MySQL

来自开放百科 - 灰狐
2007年11月30日 (五) 22:28Allen (讨论 | 贡献)的版本

跳转到: 导航, 搜索

在 FreeBSD 5.5, 6.1 上安装 Lightttpd,PHP,MySQL

今天在一台跑 FreeBSD 5.5 的 Intel 至强服务器上成功安装 MySQL,PHP,Lighttpd等软件包, 现整理如下与大家分享. 随后还有在FreeBSD 上 Java 系统的安装等. (注意: 在FreeBSD下有 Packages , Ports 两种安装软件包的方式供用户选择)

1. install mysql 4.1 mysql41-client // version is 4.1.18

pkg_add -r mysql41-server

pkg_add -r mysql41-client

/usr/local/bin/mysql_install_db

chown -R mysql /var/db/mysql/

chgrp -R mysql /var/db/mysql/

/usr/local/bin/mysqld_safe -user=mysql &

/usr/local/bin/mysqladmin -u root password ‘newpassword’

2. install php4,并support fastcgi

cd /usr/ports/distfiles

fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/php-4.4.2.tar.bz2

or http://download.freelamp.com/LAMP/

bunzip2 php-4.4.2.tar.bz2

tar xvf php-4.4.2.tar

./configure –enable-fastcgi –enable-force-cgi-redirect \
--with-mysql=/usr/local/mysql \
make
make install

— php -v

PHP 4.4.2 (cgi-fcgi) (built: Jun 23 2006 01:26:36) Copyright (c) 1997-2006 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

3. bind php4 and mysql (这步有问题,mysql的库总加载不上)

cd /usr/ports/databases/php4-mysql

make

make install

The following line has been added to your /usr/local/etc/php/extensions.ini

configuration file to automatically load the installed extension:

extension=mysql.so

4. install lighttpd

pkg_add -r lighttpd

touch /var/log/lighttpd.error.log

touch /var/log/lighttpd.access.log

chown www:www /var/log/lighttpd.*

config php.ini, lighttpd.conf

cd /usr/local/etc/

cp lighttpd.conf.sample lighttpd.conf

cp php.ini-recommended php.ini

修改 lighttpd.conf

server.modules = (

“mod_access”,

“mod_fastcgi”,

“mod_accesslog” )

server.document-root = “/usr/local/www/demo/”

fastcgi.server = ( “.php” =>

( “localhost” =>

(

“socket” => “/tmp/php-fastcgi.socket”,

“bin-path” => “/usr/local/bin” )))

测试:

touch test.php

phpinfo();

?>

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

或者

Usage: /usr/local/etc/rc.d/lighttpd [fast|force|one](start|stop|restart|rcvar|status|poll)

http://localhost/test.php

OK :)

————————————

在 FreeBSD 6.1 上安装 Lightttpd,PHP, MySQL 过程异常简单

1. install mysql 5

cd /usr/ports/databases/mysql50-server

make install

后面步骤同上

2. install php5

下载ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/php-5.1.2.tar.bz2

 ./configure –enable-fastcgi –enable-force-cgi-redirect --with-gd --with-zlib-dir=/usr/local\
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/bin/mysql_config 
make
make install

3. bind php5 and mysql (mysql的库加载成功)

cd /usr/ports/databases/php5-mysql

make

make install

cd /usr/ports/databases/php5-mysqli

make

make install

more /usr/local/etc/php/extensions.ini

extension=mysql.so
extension=mysqli.so

4. install lighttpd (同上)

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱