文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>广取精华,linux论坛

广取精华,linux论坛

时间:2005-12-06  来源:redandblack007

参考文章

http://www.ccw.com.cn/server/yyjq/htm2005/20050802_09K19.htm

http://bbs.chinaunix.net/viewthread.php?tid=502274&extra=page%3D1%26filter%3Ddigest

http://bbs.chinaunix.net/viewthread.php?tid=613483&extra=page%3D1%26filter%3Ddigest

http://bbs.chinaunix.net/viewthread.php?tid=644567&extra=page%3D1

 

在LINUX9下建立论坛

Mysql+apache+php+phpBB

mysql-4.1.15.tar.gz    php-4.3.10.tar.gz    httpd-2.0.55.tar.gz

phpBB-2.0.18.tar.gz   lang_chinese_simplified.tar.gz     subSilver_chinese_simplified.tar.gz

A:安装mysql

cp mysql-4.1.15.tar.gz /usr/local/

cd /usr/local

tar zxvf mysql-4.1.15.tar.gz

cd mysql-4.1.15

emacs INSTALL-SOURCE或者./configure –help (查看安装详细信息)

groupadd mysql

useradd -g mysql mysql

./configure --prefix=/usr/local/mysql

(--prefix=/opt/mysql 把mysql-4.1.9指定安装到/usr/local/mysql目录中;)

Make

Make install这样就安装完了

配制mysql:安装只是第一步,我们还要对mysql进行相应的配制;

一般的情况下mysql要找配制文件my.cnf,位置在/etc目录下,所以我们得把文件my.cnf文件放到/etc/目录下。让mysql服务器启动时能找到它。

cp support-files/my-medium.cnf /etc/my.cnf

cd /usr/local/mysql

bin/mysql_install_db --user=mysql

创造MySQL授权表,mysql_install_db,这个命令的用途就是做这个的。

chown -R root  .

chown -R mysql var

chgrp -R mysql .

bin/mysqld_safe --user=mysql &       启动mysql服务器

启动过后,我们要查看mysql是否启动了,应该用下面的命令;

ps -aux | grep mysqld

 

数据库安装好后,我们应该为mysql数据库创建一个管理帐号。要把root用户设置为管理员,我们应该运行下面的命令;

#/usr/local/mysql/bin/mysqladmin -u root password 123456

如何进入mysql数据库?以mysql数据库管理员root,密码为123456为例;

/usr/local/mysql/bin/mysql -uroot –p123456

输出上面的命令后,出现的是如下的提示;

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 6 to server version: 3.23.58

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql>;

查看mysql中都有哪些数据库?
代码:
mysql>; show databases;
+----------+
| Database |
+----------+
| mysql    |
| test     |
+----------+
2 rows in set (0.00 sec)

mysql>;

在mysql安装好,设置好管理员后,第一次进入系统,我们用show databases;命令查看数据库的列表,发现有两个数据库,mysql和test,这是系统自建的.

B:安装apache-2.0.55

tar zxvf httpd-2.0.55.tar.gz

cd httpd-2.0.55

./configure –help

./configure --prefix=/usr/local/apache  --enable-so

--enable-track-vars –

-enable-cgi

--with-config-file-path=/usr/local/apache/conf

解释:
--prefix=/opt/apache 指定把apahce安装到/usr/local/apache目录中;
--enable-cgi 支持CGI;
--with-config-file-path=/usr/local/apache/conf 指定把apache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在这个目录中;
--enable-track-vars 为启动cookie的get/post等追踪功能

Make

make install

启动apache守护进程 /usr/local/apache/bin/apachectl start

httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
这时打开浏览器,输入127.0.0.1或你的电脑名,我的为tian1118,然后你就可以看到漂亮的羽毛,证明apache安装成功,而且可以正确显示出简体中文,真爽。
再仔细看看,好像有点问题。cp httpd.conf beifei 备份一下,免得自己改错了。
emacs httpd.conf
找到#ServerName www.example.com:80
把它改为ServerName 127.0.0.1
../bin/apachectl restart  没有出错提示证明成功

cd /usr/loca/apache2/conf/

 

一些重要配制选项的说明:
ServerRoot "/usr/local/apache"
[注]这是ServerRoot指定apache程序所在的的目录,比如日志文件、配制文件等目录,这个不要改动。

Listen 80 [注]apache 默认端口80,如果您想改在别的端口访问,就改一下。最好还是不要改了。比如我要改为8080,那访问网址时,应该用如下的格式
http://10.0.2.30:8080

ServerAdmin root@localhost 注:在这里,把管理员的信箱放上去,比如我的管理信箱是 [email protected] 那就改这句为

ServerAdmin [email protected]

#ServerName new.host.name:80 注:前面有#号就是注销掉了,我们要在下面加一行。比如我没有域名,我就用自己本地机的IP设置为10.0.2.30,所以我在这里就设置了相同的;应该是:当然,这个得与自己机器所设置的IP地址一致,在这里,我的网卡的IP地址,我已经设置成了10.0.2.30

ServerName 10.0.2.30:80

DocumentRoot "/usr/local/apache/htdocs" 这个是存放网页的目录,也就是说,我们应该把网页的目录指定到哪里,这样当访问网址时,就调用这个目录的文件。比如我把存放网页的目录指定到了/usr/local/apache/htdocs,那应该这样写

DocumentRoot "/usr/local/apache/htdocs "

<Directory "/usr/local/apache/htdocs ">; 注:这句应该和DocumentRoot 的目录保持一致。比如我在上面设置的是/usr/local/apache/htdocs,那在这句中,也应该用这/usr/local/apache/htdocs

 

C:安装php-4.3.10

tar -zxvf php-4.3.10.tar.gz

cd php-4.3.10

./configure –help

./configure --prefix=/usr/local/php

--with-apxs2=/usr/local/apache/bin/apxs

--with-mysql=/usr/local/mysql

说明:

--prefix=/usr/local/php 指定把php-4.4.0安装到/usr/local/php目录中;
--with-mysql=/usr/local/mysql 指定mysql数据服务器安装的位置;
--with-apxs2=/usr/apache/bin/apxs 这是加入apache中为DSO模块的位置;
-enable-track-vars 为启动cookie的get/post等追踪功能
--with-config-file-path=/usr/local/php/etc 指定php的配制文件存放的目录是/usr/local/php/etc目录,我们安装完成后,也要把php.ini复制到这个目录中来。

Make

Make install

cp php.ini-dist /usr/local/php/etc/php.ini

php与apache整合
emacs /usr/local/apache2/conf/httpd.conf  找到DirectoryIndex改为如下:
DirectoryIndex index.html index.php index.htm index.html.var
找到
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
在它后面添加
AddType application/x-httpd-php .php
/usr/local/apache2/bin/apachectl restart

 

检测apache + php + mysql

 

cd /usr/local/apache/htdocs

touch test.php

vi test.php

<?
            phpinfo( );
            ?>
保存退出 :wq

touch mydqltest.html

vi mysqltest.html

<html>
         <body>
            <?
               $link=mysql_connect('localhost','root');
                mysql_select_db('mysql');
               $str="select * from user;";
               $result=mysql_query($str,$link);
               $show=mysql_num_rows($result);
               mysql_close($link);
               for ($i=0;$i < $show;$i++)
                   {
                 $arr[$i]=mysql_fetch_array($result);
                   };
            ?>
<table align=center border=1>
          <tr align=center>
             <td>Host</td>
             <td>User</td>
             <td>Password</td>
          </tr>
     <?for ($i=0;$i<$show;$i++){?>
          <tr>
            <td><?echo $arr[$i][Host]?></td>
            <td><?echo $arr[$i][User]?></td>
            <td><?echo $arr[$i][Password]?></td>
         </tr>
             <?};?>
          </body>
       </html>
保存退出 :wq

把apache mysql php 配制好后,就重启httpd 和mysql 服务.

 

D: phpbb的安装过程.

http://jaist.dl.sourceforge.net/sourceforge/phpbb/lang_chinese_simplified.tar.gz

http://jaist.dl.sourceforge.net/sourceforge/phpbb/subSilver_chinese_simplified.tar.gz

www.phpbb.com

 

phpBB-2.0.18.tar.gz  phpbb的源码包

lang_chinese_simplified.tar.gz
subSilver_chinese_simplified.tar.gz 这二个是支持中文的包

cp phpBB-2.0.12.tar.gz /soft/apache/htdocs
cd /soft/apache/htdocs
tar -zxvf phpBB-2.0.12.tar.gz
这时会出现phpBB2目录
tar -zxvf lang_chinese_simplified.tar.gz
tar -zxvf subSilver_chinese_simplified.tar.gz 解压支持中文包的软件.
会出现lang_chinese_simplified和subSilver目录
cp lang_chinese_simplified/ phpBB2/language/ -r
cp subSilver/ phpBB2/templates/ -fr
chmod 777 phpBB2/config.php
cd ../bin/
./apachectl start 启动apache

 

为phpbb2建立数据库:

# mysql –u root –p
Enter password: xxxxxxxxx      
Your Mysql connection id is 3 to server version: 4.11
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.
Mysql> create database phpbb2;      “为phpbb2建立数据库”
Query OK, 1 row affected (0.01 sec)
Mysql>grant all privileges on phpbb2.* to phpbbuser@localhost identified by ‘76543981’ ; “将建立的 phpbb2权限给phpbbuser 帐号,并且设定密码”
mysql>quit
Bye

测试刚建立的数据库与帐号是否可以使用:

# mysql –u phpbbuser –p
Enter password: xxxxxxxxx
Your Mysql connection id is 3 to server version: 4.11
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.
Mysql> connect phpbb2;
Connection id:    5
Current database: phpbb2
mysql>quit
Bye http://220.248.7.198/phpBB2/install/install.php 进入phpbb的安装界面.这里有许多需要填写的信息.

填写结束后按“开始安装 ”按钮进行安装

这时安装成功,系统会提示你在删除phpBB2目录中的install/ contrib/

# rm –rf install
# rm –rf contrib 

再次登录系统,由于删除了config.php 文件,所以只能以系统管理员的身份登录,登录后对话框下边会出现“论坛管理员控制面板”(这个选项对于普通帐户是隱藏的)点击即可进入

  phpBB2 的论坛管理员控制面板,一共六个大版面:系统管理、版面管理、普通管理、团队管理、风格管理、会员管理。在系统管理版面里包含您论坛的各项统计资料. 任何时候您都可以通过点击控制面板左上方的控制面板首页返回到这一页. 而点击在控制面板左上方的 phpBB 标志图示可以回到您的论坛首页

相关阅读 更多 +
排行榜 更多 +
杖剑传说切换技能方案指南

杖剑传说切换技能方案指南

冒险解谜 下载
都市毁灭模拟器

都市毁灭模拟器

音乐节奏 下载
神探诡事录器门位置一览

神探诡事录器门位置一览

冒险解谜 下载