Location : Web Hosting - Web Hosting Knowledge Base - phpBB Tutorial

Recreate config.php file for phpbb forum Tutorial

It is always a good practice to backup your phpbb program folder and database regularly to avoid things like loosing any important files or data, such as the config.php file that contains the database connection info for your phpbb board, loosing this file basically takes down your phpbb board entirely because your phpbb program does not have the necessary connection info to access the database to process the forum web pages.

Luckily, recreating the config.php file is not that difficult, there are two options for you, one is through the dbinformer.php file that is found in the contrib folder in your phpbb program, the other method is to manually create the file with the basic settings.

recreating config.php using dbinformer.php

In the php installation process, it is advised to remove the install and contrib folder after the installation, because these two folders are no longer needed after the installation and may impose security risks to your phpbb forum if the two folders are being accessed by hackers.

Since the contrib folder has been removed in your live phpbb forum program folder, you can still obtain the dbinformer.php file from the phpbb Full package compressed file :-

  1. download phpbb Full package
  2. extract the compressed file and upload the contrib folder to your hosting account, place it in the phpbb root folder
  3. enter http://yourdomain.com/phpbb/contrib/dbinformer.php in your browser window
  4. enter the database access information (database name, user, password etc.) as requested in the screen
  5. checked the box Generate config file and hit Submit
  6. copy the generated code and save it to a file named config.php
  7. Upload the new config.php file to your hosting account, place it in the phpbb root folder
  8. Test accessing your forum again
  9. Manually recreate config.php file

    Manually recreating config.php requires the connection string format phpbb is using, if you have another phpbb forum, you can copy the config.php file over and manually change the information in it for connecting to the mysql database of this current phpbb forum, the config file content should look like :-


    $dbms = 'mysql';

    $dbhost = 'localhost';
    $dbname = 'username_dbname';
    $dbuser = 'username_dbuser';
    $dbpasswd = 'password_set_for_username_dbuser';

    $table_prefix = 'phpbb_';

    define('PHPBB_INSTALLED', true);


    Below explain each of the options and what are the values available for each of the settings :-


    • MySQL 3.x - 'mysql'
    • MySQL 4.x and MySQL 5.x = 'mysql4'
    • postgres = 'postgres7'
    • MSSQL = 'mssql'
    • MSSQL ODBC = 'mssql-odbc'
    • oracle = 'oracle'
    • msaccess = 'msaccess'

    If you are not sure what type of database you are using for you phpbb forum, login to your hosting account control panel, and you will see the database name and current version of your hosting account, or if you are still not sure, send a support ticket to your web hosting provider to check on it for you.


    Depending on where you are hosting your phpbb database, if it is in the same server as your phpbb program, then enter localhost, otherwise enter the domain name or IP address of your remote server where you are hosting your pphbb database.


    This is the name of the database you have created to contain phpbb data, if you are hosting on a cpanel server, the format is usually username_dbname, you can login to your hosting account control panel, click into the SQLDB option and the databases, database username, you have created and assigned will be listed.


    This is the database user name you have created and given access to the database entered in the $dbname above. The format is username_dbusr if you are on a typical cpanel hosting.


    Pretty straight forward, the password you have set for the $dbuser above.


    This is the prefix you have given for phpbb table names creation during the installation process, this has to be a match with your current table names, otherwise phpbb program will not be able to locate tables in your database even you have entered the correct database login info above, if you have left this as default during installation, then enter phpbb_, you can double confirm this by login to hosting account, click into SQLdb option, click on phpMyAdmin option at the bottom of the screen, and select the phpbb database, phpMyAdmin will list out the tables available in the database, see if there is any prefix to the table names.


    This indicates that this phpbb forum is installed ('TRUE') and should not be redirected to an install process, basically used by phpbb program internally to determine the state of your phpbb forum, no need to change anything and just leave it as it is in the config.php file.

    After complete filling in the config.php file, save it and upload to the hosting account, place the file in phpbb root folder. You can now test accessing your forum.