CSUF LogoCSUF Site Navigation
optics.csufresno.edu

FC6 Server & General Setup phpBB

Department of Electrical and Computer Engineering
Assistant Professor Gregory R. Kriehn
Forums
Wiki
FC6 phpBB
phpBB is a "high powered, fully scalable, and highly customizable Open Source bulletin board package. phpBB has a user-friendly interface, simple and straightforward administration panel, and helpful FAQ. Based on the powerful PHP server language and your choice of MySQL, MS-SQL, PostgreSQL or Access/ODBC database servers, phpBB is the ideal free community solution for all web sites."

Installation of the Bulletin Board requires first heading over to their website:

http://www.phpbb.com/

Click on the Downloads link at the top of the web page. At the time of this writing, the current version of phpBB is phpBB 2.0.22. Scroll down to the Full Package
section, click on the gZIP link, and download the compressed phpBB-2.0.22.tar.gz file. Once it downloads, move the file to /var/www/html:
~> sudo mv ~/Desktop/phpBB-2.0.22.tar.gz /var/www/html/.
Then decompress the source:
~> sudo tar vfzx phpBB-2.0.22.tar.gz
Once the package has been decompressed, delete the source file, and move the directory to forums:
~> sudo rm phpBB-2.0.22.tar.gz
~> sudo mv phpBB2 forums
The permissions on the directory are set incorrectly. They can be fixed using chown:
~> sudo chown -R root.root forums
Now, before you can install phpBB, you need to create a new database. This can be done a couple of ways. Choose either Option 1, or Option 2, but not both.

Option 1 - MySQL
Login to MySQL using root:

~> mysql -u root -p
Type in the MySQL super user password, and hit Enter.

Next, create a database called phpbb:

mysql> create database phpbb;
and verify its existence:
mysql> show databases;
You should now see a database called phpbb. With the database created, exit:
mysql> exit;
Option 2 - phpMyAdmin
Login to your phpMyAdmin account. Under Create new database, enter "phpbb". Then click on the Create button. After clicking the button, you should see a statement that says:  "Database phpbb has been created". Once finished, click on the green Exit icon to exit phpMyAdmin.

Run the Install Script
To run the installation script, the forums/config.php file needs to be writable by all. Change into the forums directory:
~> cd /var/www/html/forums
and change the permissions of the config.php file:
~> sudo chmod go+rw config.php
Next, open Firefox and go to the following address:
http://[host].[domain].[name]/forums/install/install.php
This will launch the phpBB2 Installation Page.  

Under Basic Configuration, change the Database Type: to MySQL 4.x/5.x.  

Under Database Configuration, type in "phpbb" for Your Database Name:, "root" for the Database Username:, and your MySQL super user password for the Database Password:.

Under Admin Configuration, type in your e-mail address in Admin Email Address:, change the Script path: to "/forums/", and type in your username and password for Administrator Username: and Administrator Password: (and Administrator Password [Confirm ]:), respectively.

When you are finished, click on Start Install. This should take you to a page that confirms the creation of the admin username. Click  on Finish Installation. After you do so, you will notice a warning that says: "Please ensure both the install/ and contrib/ directories are deleted". Let's do so now:

~> cd /var/www/html/forums
~> sudo rm -r install/
~> sudo rm -r contrib/
Likewise, let's change the permissions on config.php so that it is no longer world writable:
~> sudo chmod go-w config.php
If you now point yourself to http://[host].[domain].[name]/forums, you will be taken to the phpBB page. If you click on the Log in link, you can login with your administration username and password. Do so now to verify that you can log into your board, and then exit.

Customization of phpBB
At this point, I like to install the RedSilver style, as it fits more closely to Fresno State's (and my web site's) color scheme. If you go to the phpBB website, click on the Styles link. From there, click on Downloads, followed by Color. Scroll down to RedSilver, and click on the RedSilver1.03.zip link. Once it downloads, move it over to the /var/www/html/forums/templates directory:

~> sudo mv ~/Desktop/RedSilver1.03.zip /var/www/html/forums/templates/.
Change to the templates directory:
~> cd /var/www/html/forums/templates
and unzip the file:
~> sudo unzip RedSilver1.03.zip
Once the package has been unzipped, delete the source file, and change the permissions of the directory. From there, change into the RedSilver directory:
~> sudo rm RedSilver1.03.zip
~> sudo chmod go+rx RedSilver
~> cd RedSilver
The permissions are not set correctly in the subdirectory either, so let's fix those as well:
~> sudo chmod go+r *.*
~> sudo chmod go+rx admin
~> sudo chmod go+rx images
~> sudo chmod go+r ./*/*.*
~> sudo chmod go+rx images/lang_english
~> sudo chmod go+r ./*/*/*.*
The next thing that I like to do is change the overall header for the theme. If you open up the overall_header.tpl file using sudo, perform a search for the following code:
<table width="100%" height="100" background="templates/RedSilver/images/top.jpg"">
  <tr valign="top">
    <td>
      <center><span class="maintitle">{SITENAME}</span><span class="gen"><br /><br />{SITE_DESCRIPTION}</center>
      </td>
    </tr>
</table>
Instead of having a table with just one column, I like to create a table with three columns. In the left column, I have an image that, when clicked on, will take you back to my homepage; in the center column, the name of my forum; and in the right column, a few links that act as shortcuts to various points on my web pages. As a result, the code now looks like:
<table width="100%" height="100" background="templates/RedSilver/images/top.jpg"">
  <tr valign="top">
    <td valign="middle" style="width: 94px"><font size="-1">
      <center><a href="http://optics.csufresno.edu/">
        <img src="templates/RedSilver/images/laserlight_88x88.png"
           alt="Professor Kriehn's Home Page" title="Professor Kriehn's Home
           Page"/>
        </a></center></font>
    </td>
    <td valign="middle">
      <center><span class="maintitle">{SITENAME}</span>
        <span class="gen"><br />{SITE_DESCRIPTION}</center>
    </td>
    <td valign="middle" style="width: 94px"><font size="-1"><center>
      <a href="http://optics.csufresno.edu/">
        Home</a><br />
      <a href="http://optics.csufresno.edu/~kriehn/teaching/teaching.html">
        Teaching</a><br />
      <a href="http://optics.csufresno.edu/~kriehn/optical/research.html">
        Research</a><br />
      <a href="http://optics.csufresno.edu/~kriehn/fedora/fedora.html">
        Fedora Linux</a>
      </center></font>
    </td>
  </tr>
</table>
Obviously, you will want to change several of the parameters, but this works for me. Notice, that if you use a picture, I have placed it in the ./templates/RedSilver/images/ subdirectory.

I also like to change minimum age requirement for registering on the board from 13 to 18, since I am at a University, and do not want to have to hassle with underage kids. To do this, there are several files that need to be edited. First, open up the /var/www/html/forums/language/lang_english/lang_faq.php file. Perform a search for 13, and replace it with 18. Save and exit.

Next, open up the /var/www/html/forums/language/lang_english/lang_main.php file. Perform a search for Agree_under_13 and Agree_over_13 (the lines are right next to each other). The should be changed so that they look like the following:

$lang['Agree_under_18'] = 'I Agree to these terms and am <b>under</b> 18 years of age';
$lang['Agree_over_18'] = 'I Agree to these terms and am <b>over</b> or <b>exactly</b> 18 years of age';
Save and exit. Open the /var/www/html/forums/includes/usercp_register.php file. Search for the AGREE_OVER_13 and AGREE_UNDER_13 variables. Change the lines to:
"AGREE_OVER_18" => $lang['Agree_over_18'],
"AGREE_UNDER_18" => $lang['Agree_under_18'],
Scroll down a couple of lines to the U_AGREE_OVER13 and U_AGREE_UNDER13 variables. Change them to U_AGREE_OVER18 and U_AGREE_UNDER18, respectively. Save and exit.

Finally, open the /var/www/html/forums/templates/RedSilver/agreement.tpl file. Search for the number 13. Every time it comes up, replace it with the number 18. You will change four variables (U_AGREE_OVER13, AGREE_OVER_13, U_AGREE_UNDER13, and AGREE_UNDER_13 to
U_AGREE_OVER18, AGREE_OVER_18, U_AGREE_UNDER18, and AGREE_UNDER_18). Save and exit.

With that done, go back to http://[host].[domain].[name]/forums, and login. Click on the bottom link that says Go to Administration Panel and type in your password once again. Then click on Add, under Styles Admin, and click on Install under RedSilver. The selected theme should install successfully.

Then click on Configuration, under General Admin, and type in your Site name, the Site description, and work through the general settings for your board. Under Default Style, change it to RedSilver, and click on Yes for the Override user style option. When finished, click Submit.

You are now using the RedSilver theme, have changed the header for the forum board, and raised the minimum registration age to 18.

Security and Admin Changes
There are several other mods that I like to add to phpBB in order to improve the security of the forum. This is primarily because spammers have figured out how to use bots to automatically register and post spam web site addresses on phpBB (in spite of the captcha image present on the registration page). After hunting around on the phpBB boards, I found a couple of decent articles relating to my problem:

Preventing SPAM - Bots and Humans
http://www.phpbb.com/phpBB/viewtopic.php?t=427852

Anti-Spam Thread!
http://www.phpbb.com/phpBB/viewtopic.php?t=393503

Based upon the discussion, I have installed several mods, which have stopped the spammers cold. Just click on the links, and follow the directions. The first two mods listed here stop spammers for registering, and the last two are very useful administration tools.

NOTE:  Since I am using the RedSilver theme, whenever you have to change a templates/subSilver file, change the templates/RedSilver file instead.

1.  Easy BotStopper - V 1.0.0

Description:
This MOD works by making website field invisible during registration. Spam bot that uses auto-registration script which provides an website URL will be detected and stopped.

http://www.phpbb.com/phpBB/viewtopic.php?t=375262

2.  The Humanizer - V 1.1.0

Description:
This MOD adds an additional question to your registration form — 'Yes' must be selected in order for the registration to go through successfully.

http://www.phpbb.com/phpBB/viewtopic.php?t=383788
http://www.underhill.de/downloads/phpbb2mods/thehumanizertips.txt

For this mod, I use Tip #2, which allows the changing the radio buttons to a text field box. Instead of asking the simple question, "Are you human?", I have decided to ask another question. If you wish to do the same you will have to change $lang['Are_u_human'] and $humanizer_answers fields. I've also changed the
$lang['Are_u_human_explain'] field by removing the word "stupid" in the text.

3.  Admin Userlist

Description:
This MOD lets you view all of your members and various information about them in the Admin Control Panel. From the list, you can perform various actions on multiple users. Delete, Ban, Unban, Add to Usergroup, etc...

http://www.phpbb.com/phpBB/viewtopic.php?t=117359

4.  DB Maintenance

Description:
This is a powerful hack to check the phpBB database for errors and inconsistencies. Some additional features are provided, e.g. to rebuild the search index. With an emergency platform access to the configuration is also possible when phpBB itself will not start.

http://www.phpbbhacks.com/download/4372

This last mod I found to be useful because I had accidentally messed up some of my tables as a result of using phpMyAdmin to delete spammers. At the time, in order to delete a user, I was only deleting an entry from the phpbb_user_group table, not realizing that I needed to delete a corresponding entry from the phpbb_groups and phpbb_user_group tables as well. The DB Maintenance mod fixed the tables, and because I still only had a few users that had registered, I re-ordered the user_id and group_id numbers by hand. In order to reset the auto increment counters in each of the tables, I logged into MySQL as root and ran the following commands:

mysql> use phpbb;
mysql> ALTER TABLE phpbb_groups AUTO_INCREMENT=[number];
mysql> ALTER TABLE phpbb_users AUTO_INCREMENT=[number];
mysql> ALTER TABLE phpbb_user_group AUTO_INCREMENT=[number];
where [number] is the number that I wanted to set the auto increment number to. In this case, I had 13 valid users, so I set the number to 14.

Additional Help
If you need additional help, I suggest heading over to the phpBB website and clicking on either the Support or Community links. You should be able to get most of your questions answered there.

Upgrading phpBB
The easiest way to update your phpBB installation is to follow the appropriate directions in the Knowledge base:

http://www.phpbb.com/kb/article.php?article_id=271

Since I have MODs installed, I upgrade using the .patch files.