Prev |  | Next

### 1.3.5. Configure the database access for Phorum

After setting up the database, you will have to tell Phorum how to access that database. The configuration for this is put in the file `include/db/config.php` inside your Phorum directory. This file is not included in the distribution. Only a differently named sample file is included (this is to prevent overwriting your configuration when upgrading Phorum). Copy or rename the sample configuration file `include/db/config.php.sample` to `include/db/config.php`. Then edit the `config.php` file to match the access settings for the database that was created in Section 1.3.4, “Create a database and a database user”.

If you run your website on a remote server, then either edit the configuration file directly on that server (e.g. through a UNIX prompt or an FTP client that supports this) or upload the file to the correct location after editing it locally.

In the configuration file, you will find the following settings:

type

  This setting determines what database backend is used by Phorum. Phorum is distributed with the a MySQL backend. If you are using MySQL for the database server, then you can keep the default value `mysql` here.

  If you use a third party database backend (e.g. PostgreSQL), then you can configure it here. The backend PHP script must be installed at the location `{phorum dir}/include/db/mybackend.php`. With this example, the setting of the type has to be `mybackend`.

server

  This is the hostname or IP-address of your database server. On a lot of systems, the database server will run on the same system as the web server. In those cases, the default value `localhost` will often be correct. Change this value if the database server is running on a different system than the web server.

name

  MySQL (and a lot of other database servers) can handle multiple databases in one database server. Each database is referenced by its own unique name. This setting is used for configuring the name of the database that Phorum has to use.

  If you have created the database using the example command from above (`CREATE DATABASE phorum`), then you can use the default value `phorum`.

user

  The username of the user which is used for accessing the database server. The user must have full access rights to the database, for creating and maintaining the needed tables.

password

  The password for the database user.

table_prefix

  This table prefix will be prepended to all table names that Phorum uses. If other applications are using the same database or if you have multiple Phorum installations that use the same database name, this prefix can be used to prevent table name collisions. E.g. if you set the prefix to `myprefix`, then the full name of the users table will be `myprefix_users`. For most installations, you can keep the default value `phorum`.

  ### Important

  Never change the table prefix on a running system!

port

  This port is used to connect to the database server. For most installations, you can keep the default value `3306` which is the regular port for mysql.

socket

  The socket which is used by the database server to connect to. Overrides the port if the hostname is localhost for mysql.

down_page, upgrade_page

  Phorum uses a built-in error message to inform visitors when no database connection can be made. If you want to provide a custom error message page for this, you can set this setting to the URL of the page that you want to display.

  Phorum uses a simple built-in page to inform visitors and the site admin that the database has to be upgraded. If you want to provide a custom upgrade message page for this, you can set this setting to the URL of the page that you want to display.

upgrade_page

  An optional URL for redirecting the user when the database has to be upgraded. If you want to use this field, remove the "//" in front of it.

The following options apply only to the mysql-layer:

mysql_use_ft

  This setting determines whether Phorum will use MySQL's full text algorithm for searching through postings. If enabled, searching will be much faster.

  To be able to use this feature, the MySQL server that you are using must be version 4.0.18 or higher and the database user must be allowed to create temporary tables. If these requirements are not met, then you will have to disable this setting by assigning the value `0`.

mysql_php_extension

  This option defines which MySQL PHP extension should be used. Either NULL, "mysql", "mysqli" or "mysqli_replication" for master/slave setups. If NULL, Phorum will autodetect the extension to use.

empty_search_table

  This option defines if Phorum should populate the search table with data for mysql fulltext search (useful if you use a alternate search backend which doesn't use the search table): 0 will put the messages into the search table, 1 will keep it empty.

charset

  This option specifies the charset used for the create table statements and the connection(s) later on.

  ### Important

  Never change the charset on a running system!

slaves

  This array can hold a number of slave servers to use in master/slave mode. All write queries will go to the default server above, which is the master server in this setup and read load will be split randomly over the slave servers specified in this array. If you want your master server to get read load as well you need to specify it here too. Some read queries will go to the master server anyway in case they are vulnerable to replication lag.

  Example 1.1. Configuring slaves with the MySQL layer

      <?php
          'slaves'=>array(
              array(    // Database connection 1.
              'name'          =>  'phorum5',
              'server'        =>  '192.168.1.5',
              'user'          =>  'phorum5',
              'password'      =>  'phorum5',
              'port'          =>  '3306',
              'socket'        =>  NULL),
              array(    // Database connection 2.
              'name'          =>  'phorum5',
              'server'        =>  '192.168.1.6',
              'user'          =>  'phorum5',
              'password'      =>  'phorum5',
              'port'          =>  '3306',
              'socket'        =>  NULL),
              array(    // Database connection 3.
              'name'          =>  'phorum5',
              'server'        =>  '192.168.1.7',
              'user'          =>  'phorum5',
              'password'      =>  'phorum5',
              'port'          =>  '3306',
              'socket'        =>  NULL)
          )
      ?>

Prev | Up | Next
| Home |