FreeBSD Lighttpd PHP MySQL

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
第121行: 第121行:
  
 
1. install mysql 5
 
1. install mysql 5
 +
 +
tar zxvf mysql-5.5.5-m3.tar.gz
 +
 +
cd mysql-5.5.5-m3/
 +
 +
<nowiki>./configure --prefix=/usr/local/mysql-5.5.5-m3/ --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=partition,innobase,myisammrg</nowiki>
 +
 +
make && make install
  
 
cd /usr/ports/databases/mysql50-server
 
cd /usr/ports/databases/mysql50-server

2010年8月19日 (四) 09:24的版本

在 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

tar zxvf mysql-5.5.5-m3.tar.gz

cd mysql-5.5.5-m3/

./configure --prefix=/usr/local/mysql-5.5.5-m3/ --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=partition,innobase,myisammrg

make && make install

cd /usr/ports/databases/mysql50-server

make install

后面步骤同上

2. install php5 php-5.3.3

./configure --prefix=/usr/local/php-5.3.3 --with-config-file-path=/usr/local/php-5.3.3/etc --with-mysql=/usr/local/mysql5.0.22 --with-mysqli=/usr/local/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/local --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --disable-ipv6 --without-pear --with-fpm-user=www --with- fpm-group=www

下载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

注意: 这时系统就支持图像验证码了,但要记着重新启动 Lighttpd

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 (同上)

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

变换
操作
导航
工具箱