Cloud9 PHP workspaces actually come with phpPgAdmin installed out of the box, surprise surprise Because of that, we don’t have to install anything. The steps we’ll take are:
- Configure Apache
- Set a password for user
ubuntu in Postgres
- Run phpPgAdmin on the right port
Once you have Postgres setup, you’ll have to edit
/etc/apache2/apache2.conf and add this line to it:
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 127.0.0.0/255.0.0.0 ::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>.c9users.io:8081/ and phpPgAdmin at
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:
/etc/apache2/ports.conf and change 8080 to 8081
/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
ubuntu as the username and the password you set above to log into the interface.