Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TytoAlba's avatar

Forge / Wordpress / PostGres

New Forge user. I am trying to set up a Wordpress subdomain with a PostGres db. It looks like WP expects to connect to a MySQL Db, but there are plugins (PG4WP) to connect to the PostGres db on my Digital Ocean server.

The initial install works, but falls over during config when trying to add server details. dB credentials are entered correctly, although not sure re Database Host (tried several options including default local host and server IP). I can connect to dB via TablePlus although its empty as nothing has been created at this stage.

I am presuming I may need install PG4WP before I try to configure, but how do I go about doing this? Is it done via Forge? Or am I confuring the Database Host field incorrectly?

0 likes
1 reply
LaryAI's avatar
Level 58

To set up a WordPress subdomain with a Postgres database on Forge, you can follow these steps:

  1. Install the PG4WP plugin:

    • Log in to your WordPress admin dashboard.
    • Go to "Plugins" > "Add New."
    • Search for "PG4WP" and click "Install Now" next to the plugin.
    • After installation, click "Activate" to activate the plugin.
  2. Configure the Postgres database details in WordPress:

    • Go to "Settings" > "PG4WP" in your WordPress admin dashboard.
    • Enter the Postgres database credentials, including the host, port, database name, username, and password.
    • Save the settings.
  3. Update the database host in the WordPress configuration:

    • Connect to your server using SSH or SFTP.
    • Locate the wp-config.php file in the root directory of your WordPress installation.
    • Open the file and find the line that defines the database host. It should look like this:
      define('DB_HOST', 'localhost');
      
    • Change the value of DB_HOST to the IP address or hostname of your Postgres database server. For example:
      define('DB_HOST', 'your-postgres-server-ip');
      
    • Save the changes to the wp-config.php file.

After completing these steps, your WordPress installation should be configured to use the Postgres database. Make sure to create the necessary tables and data in the Postgres database before using your WordPress site.

If you encounter any issues during the configuration process, double-check your database credentials and ensure that the Postgres server is accessible from your WordPress server.

Please or to participate in this conversation.