<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[[感谢原创]在FreeBSD下安装mysql+apache+php ]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Wed, 22 Aug 2007 05:31:48 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	<br/> <br/> &nbsp; 1. 安装Mysql<br/> &nbsp; 2. 安装Apache<br/> &nbsp; 3. 安装PHP<br/> &nbsp; 4. 配置httpd.conf<br/> &nbsp; 5. 启动/停止apache<br/> <br/><br/><br/>1. 安装Mysql<br/>================<br/><br/><br/>《MySQL Reference Manual》手册中提供了标准安装方法，详见"MySQL Reference Manual -> 2. Installing MySQL -> 2.7. Installing MySQL on Other Unix-Like Systems"<br/><br/><br/>1.1 二进制版本的安装方法<br/><br/># created by wandering 2005/04/09<br/>--------------------------<br/>#<br/># 目前的Mysql都是编译好的二进制代码，configure后可直接使用，且无需初始化数据库<br/># 默认情况，我把安装文件放在/usr/src目录中，把应用安装到/usr/local目录中<br/>#<br/>shell> 先创建mysql用户和mysql组<br/>shell> cd /usr/local<br/>shell> tar zxvf mysql-standard-4.1.11-unknown-freebsd4.7-i386.tar.gz<br/>shell> ln -s ./mysql-standard-4.1.11-unknown-freebsd4.7-i386 ./mysql<br/>shell> cd mysql<br/>shell> scripts/mysql_install_db --user=mysql<br/>shell> chown -R root &nbsp;.<br/>shell> chown -R mysql data<br/>shell> chgrp -R mysql .<br/>shell> bin/mysqld_safe --user=mysql &<br/>shell> /usr/local/mysql/bin/mysqld_safe --user=root &<br/>shell> echo "/usr/local/mysql/bin/mysqld_safe &" >> /etc/rc.local<br/><br/>OK，Mysql已安装完毕。<br/> <br/> <br/> <br/>1.2 源代码版本的编译安装方法<br/><br/># added by wandering 2005/12/28<br/>-----------------------------<br/>有时我们也需要编译安装, 最近我在FreeBSD6.0上安装Mysql时, 发现Mysql的二进制版本最高只支持FreeBSD5.3, 经测试, 二进制的安装方法没有成功. 只好手工编译安装了.<br/> <br/>安装之前一定要仔细看看INSTALL-SOURCE这个文件, 非常之有用啊!!!<br/> <br/>shell> pw group add mysql<br/>shell> pw user add -n mysql -d /usr/local/mysql -s /usr/sbin/nologin<br/>shell> tar zxvf mysql-5.0.18<br/>shell> cd mysql-5.0.18<br/>shell> ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data<br/>shell> make<br/>shell> make install<br/>shell> cp support-files/my-medium.cnf /etc/my.cnf<br/>shell> cd /usr/local/mysql<br/>shell> mkdir data<br/>shell> bin/mysql_install_db --user=mysql<br/>shell> chown -R root &nbsp;.<br/>shell> chown -R mysql data<br/>shell> chgrp -R mysql .<br/>shell> bin/mysqld_safe --user=mysql &<br/>shell> echo "/usr/local/mysql/bin/mysqld_safe &" >> /etc/rc.local<br/> <br/>OK, 可以用了.<br/> <br/> <br/>用netstat命令可以看到服务器3306端口处于监听状态。<br/><br/>/usr/local/mysql/bin/mysqladmin -u root -p password <new_password><br/>enter password:<br/># 修改root口令，root初始密码为空，所以直接回车就可以了<br/><br/>测试一下新的密码：<br/>mysql -u root -p mysql<br/>enter password:<new_password><CR><br/> <br/> <br/>*注意: 有的时候在一些系统上, mysql要求必须要有mysql.host表存在, 才能正常启动mysql服务进程. 只好把别的机子上的mysql.host的三个文件拷贝过来才能解决. 奇怪!<br/> <br/> <br/><br/>2. 安装Apache<br/>===============<br/> <br/>*注意: 建议先安装perl, 再安装apache.<br/> <br/># tar zxvf httpd-2.2.0.tar.gz<br/># cd httpd-2.2.0<br/># ./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all --enable-rewrite=shared --enable-speling=shared && make && make install<br/>#<br/> <br/>**注: 其中--enable-so选项是配置Apache以共享后安装的模块 <br/> <br/> <br/> <br/>3. 安装PHP<br/>============<br/> <br/>步骤:<br/> <br/> &nbsp; 3.1 安装gd-2.0.33.tar.gz<br/> &nbsp; 3.2 安装libxml2-2.6.27.tar.gz<br/> &nbsp; 3.3 安装libiconv-1.9.2.tar.gz<br/> &nbsp; 3.4 安装php<br/> <br/> <br/>3.1 安装gd<br/>------------<br/> <br/>gd需要以下模块:<br/> <br/> . zlib-1.2.3.tar.gz<br/> . libpng-1.2.8-config.tar.gz<br/> . freetype-2.1.10.tar.gz (可选装)<br/> . xpm-3.4k.tar.gz (可选装)<br/> . jpegsrc.v6b.tar.gz (可选装)<br/><br/> <br/>3.1.1 安装zlib<br/>-----------------<br/># tar zxvf zlib-1.2.3.tar.gz<br/># cd zlib-1.2.3<br/># ./configure && make && make install<br/> <br/>默认情况zlib被安装到/usr/local/include/<br/>http://directory.fsf.org/zlib.html<br/>http://www.zlib.net/<br/> <br/> <br/>3.1.2 安装libpng<br/>----------------<br/># tar zxvf libpng-1.2.12.tar.gz<br/># cd libpng-1.2.12<br/># ./configure && make && make install<br/> <br/>默认情况libpng被安装到/usr/local/include/libpng/<br/>http://www.libpng.org/pub/png/libpng.html<br/> <br/> <br/>3.1.3 安装gd<br/>--------------<br/># tar zxvf gd-2.0.33.tar.gz<br/># cd gd-2.0.33<br/># cp /usr/local/include/png.h .<br/># cp /usr/local/include/pngconf.h .<br/># ./configure && make && make install<br/>#<br/> <br/>*** 我遇到过gd_png.c找不到png库文件的情况, 这时要手工把png.h和pngconf.h两个文件拷贝到gd_png.c所在目录就可以了. ***<br/> <br/>默认情况gd被安装到/usr/local/include/<br/>http://www.boutell.com/gd/<br/> <br/> <br/><br/>3.2 安装libxml2<br/>-----------------<br/># tar zxvf libxml2-2.6.26.tar.gz<br/># cd libxml2-2.6.26<br/># ./configure && make && make install<br/>#<br/> <br/>http://xmlsoft.org/<br/><br/><br/>3.3 安装libiconv<br/>-------------------<br/># tar zxvf libiconv-1.9.2.tar.gz<br/># cd libiconv-1.9.2<br/># ./configure && make && make install<br/># <br/> <br/>http://www.gnu.org/software/libiconv/<br/><br/><br/><br/>3.4 安装PHP<br/>--------------<br/># tar zvxf php-5.1.4.tar.gz<br/># cd php-5.1.4<br/># vi /usr/local/apache/bin/apxs<br/> <br/>将"#!/replace/with/path/to/perl/interpreter -w"替换为"#!/usr/bin/perl -w"<br/> <br/># ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/include/libxml2/libxml --enable-mbstring --with-gd --with-zlib<br/> <br/># make<br/># make install<br/># cp php.ini-dist /usr/local/php/lib/php.ini<br/># vi /usr/local/php/lib/php.ini<br/><br/>php.ini配置：<br/>1、找到;default_charset = "iso-8859-1", 在下面添加default_charset = "gb2312"<br/>2、配置max_execution_time，它的意思为“Maximum execution time of each script, in seconds”，经常需要长时间数据操作或去处的页面应该进行适当调整，这里我设置为300秒。<br/><br/> <br/> <br/>这是在redhat下编译的一个配置实例：<br/># ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/include/libxml2/libxml --with-iconv-dir=/usr/local --enable-mbstring --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-ttf=/usr/local --with-freetype-dir=/usr/local<br/> <br/> <br/> <br/>*** 注: 在configure过程中, 可能会遇到下面的错误! Sorry, I cannot run apxs. ***<br/> <br/>configure: error: Sorry, I cannot run apxs. Either you need to install Perl or you need to pass the absolute path of apxs by using --with-apxs=/absolute/path/to/apxs<br/> <br/>网上有很多介绍解决方法的, 但最经典的只有Darrell Brogdon在2001/03/15写的<<Installing PHP as an Apache DSO>>, 这篇文章在绿盟有徐永久在2002-03-18翻译的中文版<<在Apache上以DSO方式安装PHP>>, 不过上面著名他本人就是文章的作者, 这点我表示怀疑.<br/> <br/>我之所以说这么多, 只是想说明目前我看到的方法, 没有能够真正解决这个问题的.<br/> <br/>OK, 下面我说明一下我是如何解决这个问题的:<br/> <br/>首先, 通过错误提示, 我们得知"I cannot run apxs". 我一直以为是apxs安装有问题, 但找了很久仍未得到合理的解释和解决方法.<br/> <br/>于是我直接运行"/usr/local/apache/bin/apxs"这个脚本, 得到下面的错误提示:<br/> <br/>bash: ./apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory<br/> <br/>哦, 给人的感觉很像仍然是apxs程序有问题, 但问题在哪里呢? "interpreter"是什么呢? interpreter是"解释程序"!<br/> <br/>嗯, 看来我们接近答案了, 运行"head -1 /usr/local/apache/bin/apxs"得到下面内容:<br/> <br/>#!/replace/with/path/to/perl/interpreter -w<br/> <br/>天啊, 这里没有指明正确的perl执行程序的位置! 原来这就才是真正的问题原因所在!!!<br/> <br/>把这一行更改为"#!/usr/bin/perl -w". 再运行php的configure, 一切正常!<br/> <br/>至此, 问题已解决.<br/> <br/>*** Sorry, I cannot run apxs. ***<br/><br/><br/><br/>4. 配置httpd.conf<br/>====================<br/> <br/>4.1 找到ServerName , 将 替换为本机的域名<br/>------------------------------------------<br/>ServerName freebsd6.local:80<br/> <br/> <br/>4.2 找到"DirectoryIndex index.html", 在"index.html"后面加入"index.php"<br/>------------------------------------------------------------------------<br/><IfModule dir_module><br/> &nbsp; &nbsp;DirectoryIndex index.html index.php<br/></IfModule><br/> <br/> <br/>4.3 找到<IfModule mime_module>, 在AddType application/x-gzip .gz .tgz下面加入<br/>------------------------------------------------------------------------------- <br/>AddType application/x-httpd-php .php<br/>AddType application/x-httpd-php-source .phps<br/> <br/> <br/>4.4 找到<Directory "/usr/local/apache/htdocs"> ... </Directory>, 在下面加入<br/>-----------------------------------------------------------------------------<br/><Directory /data1/apache/htdocs/it><br/> &nbsp; &nbsp;Options Indexes FollowSymLinks<br/> &nbsp; &nbsp;AllowOverride None<br/> &nbsp; &nbsp;Order allow,deny<br/> &nbsp; &nbsp;Allow from all<br/></Directory><br/><br/><Directory /data1/apache/htdocs/it_old><br/> &nbsp; &nbsp;Options Indexes FollowSymLinks<br/> &nbsp; &nbsp;AllowOverride None<br/> &nbsp; &nbsp;Order allow,deny<br/> &nbsp; &nbsp;Allow from all<br/></Directory><br/> <br/> <br/>4.5 找到<Directory "/usr/local/apache/cgi-bin"> ... </Directory>, 在下面加入<br/>------------------------------------------------------------------------------<br/><Directory "/data1/apache/htdocs/perl"><br/> &nbsp; &nbsp;AllowOverride None<br/> &nbsp; &nbsp;Options None<br/> &nbsp; &nbsp;Order allow,deny<br/> &nbsp; &nbsp;Allow from all<br/></Directory><br/> <br/> <br/>4.6 找到<IfModule alias_module> ... </IfModule>, 在中间区域加入<br/>----------------------------------------------------------------<br/>Alias /it "/data1/apache/htdocs/it"<br/>Alias /it_old "/data1/apache/htdocs/it_old"<br/> <br/>ScriptAlias /perl/ "/data1/apache/htdocs/perl/"<br/> <br/> <br/> <br/> <br/>5. 启动/停止apache<br/>=====================<br/>/usr/local/apache/bin/apachectl start<br/>/usr/local/apache/bin/apachectl stop<br/> <br/>**注: 要确保主机名能够正常被解析为本机的IP地址.<br/><br/> <br/>*** 在执行"/usr/local/apache/bin/apachectl start"的时候可能会出现下面错误提示:<br/> <br/>[Fri Dec 30 09:35:01 2005] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter <br/> <br/>解决方法:<br/> <br/>step 1<br/>-------<br/>编辑/etc/hosts和/etc/rc.conf, 配置主机域名. 例如:<br/> <br/>shell> cat /etc/hosts<br/>127.0.0.1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; localhost<br/>192.168.177.130 &nbsp; &nbsp; &nbsp; &nbsp; freebsd6 freebsd6.local<br/> <br/>shell> cat /etc/rc.conf<br/>hostname="freebsd6.local"<br/>...<br/> <br/>step 2<br/>-------<br/>on FreeBSD, you need to add a kernelmodule<br/><br/>kldload accf_http<br/><br/>grep accf /boot/defaults/loader.conf<br/>accf_data_load="NO" # Wait for data accept filter<br/>accf_http_load="NO" # Wait for full HTTP request accept filter<br/><br/>add the second to /boot/loader.conf with 'YES' to enable this permenately.<br/><br/> <br/> <br/> <br/>-----------------------------------------------------------------------------<br/><br/># 2005/04/09 16:00 - 2005/04/10 13:16 Created by Wandering<br/># 2005/12/29 23:28 Modified by Wandering<br/># 2006/03/12 19:31 Modified by Wandering<br/># 2006/03/18 00:45 Modified by Wandering<br/># 2006/07/17 23:56 Modified by Wandering<br/> <br/><br/><br/><br/><br/><br/>附录:<br/> <br/>*Apache 2.0的DSO功能简要说明：<br/>-------------------------------<br/>编译并安装已发布的Apache模块，比如编译mod_foo.c为mod_foo.so的DSO模块：<br/>$ ./configure --prefix=/path/to/install --enable-foo=shared<br/>$ make install<br/><br/>编译并安装第三方Apache模块, 比如编译mod_foo.c为mod_foo.so的DSO模块：<br/>$ ./configure --add-module=module_type:/path/to/3rdparty/mod_foo.c --enable-foo=shared<br/>$ make install<br/><br/>配置Apache以共享后安装的模块：<br/>$ ./configure --enable-so<br/>$ make install<br/><br/>用apxs在Apache源代码树以外编译并安装第三方Apache模块，比如编译mod_foo.c为mod_foo.so的DSO模块：<br/>$ cd /path/to/3rdparty<br/>$ apxs -c mod_foo.c<br/>$ apxs -i -a -n foo mod_foo.la<br/><br/>共享模块编译完毕以后，都必须在httpd.conf中用LoadModule指令使Apache激活该模块。
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [感谢原创]在FreeBSD下安装mysql+apache+php ]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>