This section contains detailed articles elaborating on some of the common issues phpBB users encounter while using the product. Articles submitted by members of the community are checked for accuracy by the relevant phpBB Team. If you do not find the answer to your question here, we recommend looking through the Support Section as well as using the Site Wide Search.

Rebuilding Your config.php File

Description: I deleted my config.php file--Help! This tutorial will help you get back on your feet.

In Categories:

Link to this article: Select All
[url=]Knowledge Base - Rebuilding Your config.php File[/url]

Rebuilding the phpBB3 config.php

  • So you have accidentally deleted your board's config.php, and now your board is not usable; or you have installed and the config.php did not get written because of incorrect file permissions. In both instances the files and database are still present and functional, they just have no way of connecting to each other. The trick here is not to panic and do something rash such as reinstalling the board. The config.php is very easily recreated manually, if you have your database details at hand.
  • So lets look at creating a new config.php.
    • To create a new config.php file you will need to use a plain text editor, such as, Notepad++. For some other text editor suggestions see, Tools needed to set up and customise phpBB.
    • Open your chosen editor and select to create a new file.
    • Into this fresh file paste the following code

      Code: Select all

      // phpBB 3.0.x auto-generated configuration file
      // Do not change anything in this file!
      $dbms = 'mysql'; //database type it may not be mysql
      $dbhost = 'database host/domain';
      $dbport = 'database port if not default';
      $dbname = 'database name';
      $dbuser = 'database user name';
      $dbpasswd = 'database password';

      $table_prefix = 'database table prefix';
      $acm_type = 'file';
      $load_extensions = '';

      define('PHPBB_INSTALLED', true);
      //@define('DEBUG', true);
      //@define('DEBUG_EXTRA', true);
    • You now have your blank config template pasted into your file, now you will need to edit various parts of it so it contains your database details.
    • It is worth noting that if you do not know your database details you will have to seek your hosts support in acquiring them. In nearly all instances the details will be the same as what you used when completing the installation form when originally installing the board.
      • $dbms = 'mysql'; Replace mysql with your database type, you have various different types of database you could be using
        • mysql
        • mysqli
        • firebird
        • mssql
        • mssql_odbc
        • oracle
        • postgres
        • sqlite
      • $dbhost = 'database host/domain'; Replace database host/domain with the host/domain address of your database server. Many hosts will use localhost in this field, but check with your host.
      • $dbport = 'database port if not default'; Replace database port if not default with the port number your database server uses to accept connections. If your database server uses the default port leave this option blank. You only need to enter a value here if your database server is not using the default port.
      • $dbname = 'database name'; Replace database name with the name of the database you installed the phpBB3 board tables into. If you have phpmyadmin access to your databases you may be able to find this out from looking there, otherwise contact your host for help with this.
      • $dbuser = 'database user name'; Replace database user name with the user name of the database user account. All databases need a user account which is used to connect to them, the user name of this user account is what needs to be entered into this field.
      • $dbpasswd = 'database password'; Replace database password with the password of the database user account. All databases need a user account which is used to connect to them, the user password of this user account is what needs to be entered into this field.
      • $table_prefix = 'database table prefix'; Replace database table prefix with the prefix of the database tables. On a default install where this is not changed it will be phpbb_ however you may have changed this when installing originall so double check. This is something else you may be able to determine by looking at the database table in phpmyadmin.
      • The following options are things you do not need to alter or worry about when recreating your config.php,
        • $acm_type = 'file';
        • $load_extensions = '';
        • @define('PHPBB_INSTALLED', true);
        • //@define('DEBUG', true); NB* Un-commenting (removing //) this line will give you the page load times at the bottom of the boards index page.
        • //@define('DEBUG_EXTRA', true);
    • Once you have complete editing the file you will need to save it as config.php making sure that the plain text editor did not save it as config.txt or config.php.txt.
    • Now you have your newly created config.php you will need to upload it using your ftp client. It will need to be uploaded into the phpBB3 forum folder so it is in the same location as the boards common.php file.
    • In most cases your ftp client will set the correct file permissions but you should check that the file has been chmod too 644 the same as you had to with phpBB2(this only applies when using a Unix based web server)
  • Remember that when creating the config.php you can have nothing outside of the starting <?php tag and the end ?> tag in the file. This includes blank lines or spaces, absolutely nothing can be outside of the php tags :)
20071009 - re-written karlsemple
20120821 - removed suggestion to use Windows Notepad - Oyabun1