Create Your Own Forum Using phpBB
Originally published at Sitepoint
If you are thinking about setting up a forum for your website you need not start from scratch. The open-source script, phpBB, can easily be installed on most web servers. This article will describe how this can be done right from downloading through to customisation.
To do this you need not know anything about PHP and the absolute minimum about databases.
phpBB is a stable, open-source, bulletin board script available as a free download from phpbb.com. It allows you to set up unlimited forums and categories. Users, moderators and user groups with varying permissions can be created. In short, everything you would expect of a bulletin board service. For a complete list of all the features supported see http://www.phpbb.com/features.php. This software can be easily installed using FTP and a browser. It will run on any PHP enabled server and requires any one of the following databases, MySQL, PostgreSQL, MS SQL or Access via ODBC.
It does not matter whether your server is running IIS or Apache although set-up tends to be simpler on an Apache web server. Any website administrator should be able to install and configure phpBB in a minimum amount of time.
An administrator’s interface allows for ongoing maintenance so that styles can be changed and topics added or removed. In fact, any administrative duties can be easily performed.
The installation instructions provided at the phpBB site are clear and straightforward. This article does not attempt to replace those instructions but to supplement them and to assist the website administrator who is not familiar with PHP. It will help you determine if you can run phpBB on your server and if so how to upload, install and configure it.
Since phpBB is written using the server-side scripting language PHP, you need to know whether your web server supports this language.
If you don’t know the answer to this question you can always ask your web host or upload the following script to your server.
Use any text editor to create this file and save it as “info.php”. The actual name of the file is not as important as the extension, “php”. In text mode upload this file to the root directory on your server and then view it by typing the address into your browser. If your server does not support PHP all you will see are the three lines of code shown above. In this case get in touch with your web host and see if PHP can be enabled for your domain. Otherwise, the configuration settings of PHP should be displayed.
Assuming that you have managed to get PHP enabled on your server, the “info.php” file will also be useful to help determine if you have the database support needed by phpBB.
Confirming database support for phpBB varies slightly depending upon the web server you are running. Let’s first look at web servers that use Apache.
Most versions of PHP on Apache are compiled with support for MySQL databases. You can confirm this by again looking at the “info.php” file. The third line of this file should be the “Configure Command”. On this line look for the words “with-mysql”. PostgreSQL is not so widely supported but you should be able to discover if your server supports it in exactly the same way but instead looking for “with-pgsql”.
There will be no “Configure Command” when PHP is running on a Windows platform so we’ll take a slightly different approach to confirm database support. Again viewing the “info.php” file, choose “Find” from your browser’s menu options and search for your database type. For instance, if we searched for “mssql” to confirm support for MS SQL Server we should find something similar to the text below:
In the same way you can test for PostgreSQL with the search string “pgsql”, for MySQL with “mysql” or for ODBC support by using “odbc”.
Use the “info.php” file to determine what version of database you have. You’ll need to know this when be begin the installation and with database and PHP support confirmed we can now begin that process.
Uploading The phpBB Files
Assuming you’ve downloaded and decompressed the files for phpBB, everything you need to upload should be in the directory “phpBB2”. The only real requirement is that the directory structure be preserved.
Use your favourite FTP programme to upload the files to your server. Make sure that all non-graphic files are transferred in ASCII mode. Most FTP programmes will do this automatically for you based on file extensions. Make sure your software is configured to transfer all files with the extensions “php”, “tpl”, “inc”, “htm” and “cfg” as text files.
After uploading change the permissions on the “config.php” file to be writeable by all. If you don’t know how to do this don’t worry about it. The programme will give you the option of saving a new “config.php” file and then overwriting the original.
Preparing for Installation
In preparation for setting up phpBB on your server you will need the following information:
Database Server Hostname/DSN:
Admin Email Address:
First a few comments about this information before proceeding. The “host name” will be the domain name where your database is hosted. If your database is hosted on the same server as your web server then all you need enter here is “localhost”. If it resides on another server you can enter the domain name or the IP address. If instead you are using ODBC to connect you will need the connection name. If you are unsure about your situation you will have to clarify the specifics with your web host.
The database name is, quite simply, the name of the database you are planning to use. You may use an existing database or create a new one. To create a new database you may again have to speak with your web host. If you are using MySQL with phpMyAdmin then it is a relatively simple matter. If you are using an existing database, table names will be created with a distinctive prefix so that the phpBB tables are readily identifiable.
The username and password need no explanation and the admin e-mail is the e-mail address for questions relating to your bulletin board.
With all your information at hand installation is as simple as pointing your browser towards the “install.php” file. If you uploaded the directory “phpBB2” and its contents to the root directory of your server then the path you need is “http://www.<your domain>/phpBB2/install/install.php”.
Fill in the text boxes and press the “Start Install” button. Within seconds you should be finished. Installation is really that simple. All the necessary database tables have been created for you. If you wish, have a look at them. There should be a total of 29 new tables and we haven’t even had to think about SQL.
Shut down your browser and don’t forget to delete the directories “contrib” and “install”. phpBB won’t run until you do so. If, during the installation, you were asked to download the “config.php” file you must now upload it to the “phpBB2” directory overwriting the existing file.
Administering Your Forum
To administer your Bulletin Board open “http://www.<your domain>/phpBB2/index.php” in your browser and log in with the administrator name and password that you specified on installation. Then click the “Go to Administration Panel” link at the bottom of the page. You’ll probably want to go to “Forum Admin”, “Management” first and set up a new forum and categories.
“Styles Admin” is probably the next area you will want to look at but before you do got to the phpBB site and see what other styles you might want to download. Upon installation, the phpBB default style “subSilver” is the only one available but any number of styles may be installed. After downloading from the phpBB site you need to upload new styles to the “templates” directory which is directly below the “phpBB2” directory. After this, new styles must be installed from the Administration panel by going to “Styles Admin”, “Add”.
Once you’ve found a theme that is to your liking you can further customise it from the administration panel by choosing “Style Admin”, “Management” and then “edit”. You can associate a theme with an entirely new Cascading Style Sheet (CSS) or you can edit the existing one.
Customising Your Forum
Once you’ve settled on a style you will doubtless want to further customise it in ways not available through the Administration panel. For instance you might well want to show your own logo rather than the phpBB logo. If you have some knowledge of HTML minor changes like this are not too difficult. Any changes you wish to make to the appearance of the header can be addressed by making changes to the file “overall_header.tpl”. Since this file is included for every page within a style your changes will take effect throughout the whole bulletin board.
Some other changes can be relatively easy to make. For instance, if it does not make sense to have user groups the appropriate code can simply be commented out of the “overall_header.tpl” file.
Be aware that phpBB allows users to choose their own styles so unless you choose to override the user’s choice of style from the general configuration menu any installed templates will be available for users to choose. If you do decide to customise styles and you also want to allow users their choice you will have to make the appropriate changes to every style template.
One change you shouldn’t make is to the copyright notice on the footer of each page.
Without much effort and at no cost you can install a professional bulletin board service on your web site regardless of the web server you are using and regardless of your level of knowledge of PHP and databases. The style of this bulletin board can be easily configured to match the look and feel of the rest of your site.
About the Author
Peter Lavin runs a Web Design/Development firm in Toronto, Canada. He has been published in a number of magazines and online sites, including UnixReview.com, php|architect and International PHP Magazine. He is a contributor to the recently published O'Reilly book, PHP Hacks and is also the author of Object Oriented PHP, published by No Starch Press.
Please do not reproduce this article in whole or part, in any form, without obtaining written permission.
Copyright © 2017 softcoded -
the Toronto web design & development company