Documentation

Cookbook: Setting up phpBB

You will need PHP support correctly configured in Cherokee, and PHP with the MySQL module installed. The default configuration already provides a valid PHP configuration for Cherokee if you have php-cgi installed, but you can follow the appropriate recipe about setting up PHP in case you don’t have it available for some reason.

Under these conditions, you could start the installation and you would already be able to have your site up and running.

Installation

phpBB can be installed quite easily. Download the latest package, decompress it and point your browser to the corresponding URL.

In this example, we will be installing everything under /var/www/phpBB3 and will set that as document root in cherokee-admin for our server, which will be hosting contents for the domain example.net. You can modify this going to Virtual serversdefaultBasicsDocument Root. You can delete all the unnecessary rules of your default out-of-the-box configuration.

media/images/cookbook_phpbb_rules.png
Rule list

This is all you need to do with Cherokee, for now.

If you intend to use the same domain, insert the appropriate entry in your /etc/hosts or equivalent file.

Entry for your /etc/hosts
127.0.0.1       localhost example.net

First download the phpBB3 package and proceed decompressing it to the desired path.

Second, create the database for the installation. Log in to MySQL with your administration user and password:

mysql -u root -p

And create the database. We will be using the name phpbb, the user phpbbuser and the password phpbbpassword, but you should set up your own.

CREATE DATABASE phpbb;
GRANT ALL PRIVILEGES ON phpbb.* TO phpbbuser@localhost IDENTIFIED BY 'phpbbpassword';
GRANT ALL PRIVILEGES ON phpbb.* TO [email protected] IDENTIFIED BY 'phpbbpassword';
FLUSH PRIVILEGES;
quit;

Configuring with the Wizard

Cherokee-Admin provides a wizard for phpBB that will configure the web server appropriately. Just find it under the Web Applications category, provide some basic information and you are good to go.

Then point your web browser to http://example.net and follow all the steps. Basically you will have to provide the database information and troubleshoot any possible warning, but the process is fairly straight forward.

media/images/cookbook_phpbb_1_intro.png
Introduction
media/images/cookbook_phpbb_2_req.png
Requirements
media/images/cookbook_phpbb_3_db.png
Database settings
media/images/cookbook_phpbb_4_admin.png
Administrator details
media/images/cookbook_phpbb_5_config.png
Configuration file
media/images/cookbook_phpbb_6_advanced.png
Advanced settings
media/images/cookbook_phpbb_7_create.png
Create database tables
media/images/cookbook_phpbb_8_final.png
Final stage

Once you are done you will be redirected to the Administration control panel. If not, you should have a link at the bottom of the page. You need to eliminate the /var/www/phpBB3/install subdirectory or you will not be allowed to go any further.

media/images/cookbook_phpbb_adm_warning.png
Warning

It is just a security precaution. Once you have done this, you can proceed.

media/images/cookbook_phpbb_adm.png
After deletion

The basic installation is done. You can see the software running just by accessing http://example.net/

media/images/cookbook_phpbb_running.png
phpBB running

URL rewrites

To beautify your URLs you will need to write some redirection rules and apply some patches. This feature seems to not be supported in phpBB, so you will have to download phpBB’s mod_rewrite module and apply the patch. There are several alternative patches available from different sources. Since you will need to modify by hand some code, your best alternative is probably sticking to some pre-modded version.

One such version is phpBB SEO. Make sure the release you are using matches that of your installed phpBB.

After applying the fixes, mostly overwriting the files with the ones provided, you will have to generate an .htaccess file. It will not work for Cherokee, but it will give you the rewrite-directives that need to be translated.

These need to be created as Regular Expression type rules that match our translated directives. The rules must be Final and managed by the Redirection handler. Within the handler you will need to specify only the type -Internal - and substitution to perform. The regular expression is inherited, so no need to re-type it.

Just one precaution must be taken before you start playing around with rewriting rules. Despite these, you will probably want to ensure that existing files, directories or symbolic links are used instead of matching (and re-directing) them with rewrite rules. To do this you will have to create one File exists-type rule that matches any file and that is both Final and managed by the list & send or static handlers.

Once you start creating new rules, just make sure to keep the PHP -non final- one at the top of the list and that the next one is your static file managing rule.

This is a set of rewrites that is known to have worked with phpBB3 and phpBB-SEO simple. Please use them as an orientation, since they could very well fail with the specific phpBB mod_rewrite patch you are using.

Basic forum access

Regular Expression

^/[a-z0-9_-]*-f([0-9]+)/?(p([0-9]+)\.html)?$

Substitution

/viewforum.php?f=$1&start=$3

Topics with virtual folder

Regular Expression

^/[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$

Substitution

/viewtopic.php?f=$1&t=$2&start=$4

Global announces with virtual folder

Regular Expression

^/announces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$

Substitution

/viewtopic.php?t=$1&start=$3

Topic without forum ID & DELIM

Regular Expression

^/[a-z0-9_-]*/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$

Substitution

/viewtopic.php?t=$1&start=$3

Profiles

Regular Expression

^/m([0-9]+)\.html$

Substitution

/memberlist.php?mode=viewprofile&u=$1

User messages

Regular Expression

^/messages([0-9]+)(-([0-9]+))?\.html$

Substitution

/search.php?author_id=$1&sr=posts&start=$3

Groups

Regular Expression

^/g([0-9]+)(-([0-9]+))?\.html$

Substitution

/memberlist.php?mode=group&g=$1&start=$3

Post

Regular Expression

^/p([0-9]+)\.html$

Substitution

/viewtopic.php?p=$1

The team

Regular Expression

^/the-team\.html$ /memberlist.php?mode=leaders

Substitution

^/[a-z0-9_-]+/?(p([0-9]+)\.html)?$ /viewforum.php?start=$2