Setting Up phpPgAdmin



Cloud9 PHP workspaces actually come with phpPgAdmin installed out of the box, surprise surprise :wink: Because of that, we don’t have to install anything. The steps we’ll take are:

  1. Configure Apache
  2. Set a password for user ubuntu in Postgres
  3. Run phpPgAdmin on the right port

Configuring Apache

Once you have Postgres setup, you’ll have to edit /etc/apache2/apache2.conf and add this line to it:

Include /etc/apache2/conf.d/phppgadmin

By default, you can only access phpPgAdmin from localhost, which won’t work on C9. To use it on Cloud9 (i.e. remotely) you’ll want to edit your phppgadmin config file for Apache:

sudo nano /etc/apache2/conf.d/phppgadmin

Comment out (by adding # at beginning of line) “allow from ::1/128” and remove # from the line below it, “allow from all”.

Then restart apache

sudo service apache2 reload

Setting a password for Postgres

Set a password for ubuntu in Postgres:

$ sudo sudo -u postgres psql
postgres-# \password ubuntu
Enter new password:

You’ll use this username and password to log into the phpPgAdmin interface later on but anytime you log into Posgres from the terminal you can continue to use sudo sudo as shown in other guides.

Running phpPgAdmin at the same time as a non-Apache application

phpPgAdmin uses Apache to run so if your app uses Apache then you’re all set to run both at the same time! If you want to run a NodeJS/Rails/Python application and phpPgAdmin at the same time then you’ll have to put Apache on one port and your app on another port since they’ll both try to use port 8080,

Once you have phpPgAdmin setup, you can choose one of the following:

a. Run phpPgAdmin on port 8080 and Application on 8081

This is the simplest way. All you need to do is specify 8081 as your app port instead of using the environment variable $PORT. Then you can access your app at https://<workspacename>-<username> and phpPgAdmin at http://<workspacename>-<username>

Now use ubuntu for your username and the password you set above to log into the interface.

b. Run phpPgAdmin on port 8081

The other alternative is to run Apache on port 8081. You can do this with the following steps:

  • Edit /etc/apache2/ports.conf and change 8080 to 8081
  • Edit /etc/apache2/sites-available/001-cloud9.conf and change 8080 to 8081.
  • Restart apache with sudo service apache2 restart or by restarting your runner.

You’ll then be able to access phpPgAdmin at https://<workspacename>-<username>, using ubuntu as the username and the password you set above to log into the interface.

phpPgAdmin on port 8081 not private
Tutorials - Table of Contents
split this topic #2

7 posts were split to a new topic: Can’t log into phpPgMyAdmin interface

split this topic #3

A post was split to a new topic: Permissions needed to write to apache2.conf


Yeah it works thanks.