Talk martial arts at KarateForums.com

Bookmark and Share

Rebuilding the phpBB 3 config.php File

Rebuilding the phpBB 3 config.php File

Postby ~HG~ » August 20th 2009, 3:22 pm

So, you have accidentally deleted your board's config.php file 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 advice here is not to panic.

The config.php file is very easily recreated if you have your database details at hand.

To create a new config.php file, you will need to use a plain text editor such as Notepad on Windows or, better yet, Notepad++ or Notepad2.

Open your chosen editor and create a new file. Into this fresh file paste the following code:

Code: Select all
<?php
// 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. Next, 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 host's 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 - there are various different types of database that 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 to be sure.

$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 phpBB 3 database 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 installation where this is not changed, it will be phpbb_. However, you may have changed this when installing originally so double check. This is something else you may be able to determine by looking at the database tables 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 completed editing of 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 phpBB 3 forum folder so it is in the same location as the board's 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 to 644 - the same as you had to with phpBB 2 (this only applies when using a Unix based web server).

Remember that when creating the config.php file, 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.

Tip: To prevent the further loss of your config.php file, make a backup copy of it by renaming it configbu.php.
~HG~
Dedicated User
 
Posts: 3913
Joined: November 8th 2003, 8:54 pm
Location: Australia

Return to phpBB 3: Technical Reference

Who is online

Users browsing this forum: No registered users and 0 guests