PostgreSQL Support for PHP

This section describes how installing and configuring a PostgreSQL server.

Installing PostgreSQL Server

Install PostgreSQL Server:

# apt-get install postgresql postgresql-client

A user postgres is automatically created. In order to work with the database, you have to “su” as this user:

# su postgres

If you are used to phpMyAdmin, you may install phpPgAdmin to work with PostgreSQL:

# apt-get install phppgadmin

You may need to edit file /etc/phppgadmin/apache.conf if you want to gain access to the web interface from another computer rather than the postgreSQL server itself.

By default, login with user “postgres” is forbidden. Edit file /etc/phppgadmin/ if you want to allow this:

$conf['extra_login_security'] = false;

Creating a database for TYPO3

Become user postgres:

# su postgres

Now create a user for TYPO3 (e.g., “typo3”) with a password (e.g., “typo3”):

$ createuser -P typo3
Enter password for new role: typo3
Enter it again: typo3
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n

Create a database (e.g., “typo3db”) for user typo3:

$ createdb -O typo3 -E UNICODE typo3db

PostgreSQL Support for PHP

If you already installed phppgadmin as proposed above, you’re already done!

Otherwise, you need to install a module in order for PHP to be able to connect to a PostgreSQL server:

# apt-get install php5-pgsql