﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-网摘-文章分类-FreeBSD</title><link>http://www.blogjava.net/jvict/category/43589.html</link><description /><language>zh-cn</language><lastBuildDate>Thu, 14 Jan 2010 23:42:43 GMT</lastBuildDate><pubDate>Thu, 14 Jan 2010 23:42:43 GMT</pubDate><ttl>60</ttl><item><title>FreeBSD 8 mysql apache php java整合</title><link>http://www.blogjava.net/jvict/articles/309446.html</link><dc:creator>Documents</dc:creator><author>Documents</author><pubDate>Thu, 14 Jan 2010 05:47:00 GMT</pubDate><guid>http://www.blogjava.net/jvict/articles/309446.html</guid><wfw:comment>http://www.blogjava.net/jvict/comments/309446.html</wfw:comment><comments>http://www.blogjava.net/jvict/articles/309446.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jvict/comments/commentRss/309446.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jvict/services/trackbacks/309446.html</trackback:ping><description><![CDATA[<strong>1.下载安装FreeBSD 8，ＤＶＤ１<br />
2.安装mysql 5 - 利用ports安装<br />
</strong><font size="2">cd /usr/ports/databases/mysql50-server/ <br />
make install clean # n长的编译过程 <br />
rehash <br />
mysql_install_db --user=mysql <br />
chown -R mysql /var/db/mysql/<br />
chgrp -R mysql /var/db/mysql/<br />
/usr/local/bin/mysqld_safe -user=mysql &amp;<br />
<br />
mysqld_safe－－MySQL服务器启动脚本 <br />
mysqld_safe是在Unix或是NetWare系统推荐使用来启动MySQL服务器的方法。mysqld_safe添加了许多安全的特征，例如，当发生错误时重新启动服务器，并且可以将运行时的信息写入错误日志文件<br />
<br />
<li>The port installation will put a script file mysql-server.sh<br />
in /usr/local/etc/rc.d which will has capability to start MySQL server.<br />
To enable MySQL server to start automatically after every FreeBSD<br />
server reboot, enter the following command in CLI:
<p><span style="color: red">echo &#8216;mysql_enable=&#8221;YES&#8221;&#8216; &gt;&gt; /etc/ rc.conf<br />
</span></p>
<p>mysqladmin -u root password newpassword (改变root帐户密码）<br />
</p>
<li>MySQL 5.0 installation done. <br />
------------------------------------------------------------------------<br />
<strong>3.安装 Apache Web Server 2.2<br />
</strong>Install Apache HTTP Server 2.20 by using FreeBSD Ports Collection: <br />
cd /usr/ports/www/apache22<br />
make install clean<br />
<li>A Apache HTTP Server script apache22.sh is located at<br />
/usr/local/etc/rc.d to provide Apache HTTP Server start and shutdown <font color="#333333">.</font> <br />
service. To enable Apache web server to automatically starts whenever<br />
after server reboots, issue the following command at CLI: <br />
<span style="color: red">echo &#8216;apache22_enable =&#8221;YES&#8221;&#8216; &gt;&gt; /etc/ rc.conf<br />
</span>
<li>To start Apache HTTP web server immediately, use: <br />
/usr/local/sbin/apachectl start<br />
or<br />
/usr/local/etc/rc.d/apache22.sh start<br />
<li>Apache installation finished. <br />
<br />
<strong>4.Installing PHP Hypertext Preprocessor Scripting Language 5 and PHP 5 Extensions<br />
</strong>
<li>Install by enter the following commands on FreeBSD OS command line,<br />
wait for previous command to finish before running the next command: cd /usr/ports/lang/php5<br />
make install clean<br />
<li>If you&#8217;re prompted, select &#8220;use Apache 2.x instead&#8221;. <br />
<li>Continue with the following commands to install PHP5 extensions and modules to enable the support of the modules in Apache: <br />
cd /usr/ports/lang/php5-extensions </font>make config<br />
<li>At Options for php5-extension 1.0 menu, select all PHP<br />
extensions and modules that you may use with Apache webserver. This is<br />
a part of the configuration for PHP, where you need to enable features<br />
of PHP that come in modules, such as ability to manage user sessions,<br />
interface with databases and many others. Default extensions such as<br />
ctype functions support, HASH Message Digest Framework support, session<br />
support and etc have been selected. Other popular extensions that you<br />
most likely to be in used are MySQL database support and GD library<br />
support. Use space bar to select or unselect the extensions and press<br />
Enter when done.
<li>Continue the installation of php5-extensions with the following commands: <br />
make install clean<br />
<li>If there are any message the pops up and prompts you to select<br />
some options or configurations, you can just accept the default<br />
settings by pressing Enter. Some modules that may prompt you for action&nbsp; <br />
include php5-gd, php5-mbstring and php5-sqlite.
<li>Edit the Apache configuration file in order to enable Apache web server to load the PHP modules when initialization: <br />
<li>Go to Apache configuration file location by cd /usr/local/etc/apache2/ <br />
<li>Edit Apache configuration file by vi httpd.conf <br />
<li>Search for LoadModule lines, after the last LoadModule line, but within the same section, add the following 2 lines: <br />
AddType application/x- httpd-php .php<br />
AddType application/x- httpd-php-source .phps<br />
<li>Optionally, copy /usr/local/etc/php.ini-recommended or<br />
/usr/local/etc/php.ini-dist to /usr/local/etc/php.ini (in same<br />
directory), which will enable you to tune and change the default<br />
settings of behaviours of PHP.
<li>Start the Apache HTTP web server by using apachectl start<br />
(or restart Apache HTTP web server by using apachectl restart).<br />
apachectl is located in /usr/local/sbin, if you encounter Command not<br />
found problem, try to change directory to its location.
<li>PHP5 installation done. <font color="#333333">。</font> <br />
A web server has been setup with the FreeBSD with Apache, MySQL and<br />
PHP. The document root of the web server (where you should put your<br />
HTML and PHP files is at /usr/local/www/apache22/data/ and you will<br />
need a SecureFTP (SFTP) client such as WinSCP to upload your files to<br />
web server securely.
<p><br />
<strong>5.安装php后若apache不能启动：<br />
</strong>在 FreeBSD 下安装 apache22 会出现类似的 warming:<br />
No such file or directory: Failed to enable the 'httpready' Accept Filter</p>
<p>解决方案：<br />
#kldload accf_http并在 /boot/defaults/loader.conf 中加入下面 2 行，以便下次启动自动装载模块<br />
accf_data_load="YES"<br />
accf_http_load="YES"<br />
<br />
<strong>问题</strong><br />
[root@freebsd ~]# apachectl -t<br />
httpd: Could not reliably determine the server's fully qualified domain name, using freebsd.web for ServerName</p>
<p>解决方案：<br />
vi /usr/local/etc/apache22/httpd.conf<br />
添加这么一行：<span style="color: red">ServerName 127.0.0.1:80</span></p>
</li>
<img src ="http://www.blogjava.net/jvict/aggbug/309446.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jvict/" target="_blank">Documents</a> 2010-01-14 13:47 <a href="http://www.blogjava.net/jvict/articles/309446.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>