Users often complain that they get a “403 forbidden” message while they try to access phpPgAdmin.
As a part of our Server Management Services, we regularly help our Customers with errors related to phpPgAdmin.
Today, let us discuss the possible reasons and fixes for this error.
What causes “403 forbidden” messages in phpPgAdmin
phpPgAdmin is a mature web-based administration tool for PostgreSQL. Recently we received a support request from one of our Customers stating that they were receiving a “forbidden” message as shown below while accessing phpPgAdmin.
This error generally happens due to some restrictions in the apache configuration file. After the fresh installation of phpPgAdmin, apache2 may not allow us to access phpPgAdmin. Let us see how our Support Engineers fix this error.
How to fix “403 forbidden” messages in phpPgAdmin
Initially, after the installation of phpPgAdmin, we need to follow a series of configuration steps. If they are not followed, we may receive a “Not Found” message while accessing the phpPgAdmin.
For this, we need to configure the Apache server to tell it where to find phpPgAdmin. First, we need to edit
/etc/apache2/apache2.conf and add the following line to it.
sudo nano /etc/apache2/apache2.conf Include /etc/apache2/conf.d/phppgadmin
When you have done this, restart apache:
sudo service apache2 reload
Now, that we have configured Apache, we need to correct the permission. We need to edit the phpPgAdmin file as shown below:
sudo nano /etc/apache2/conf.d/phppgadmin
Here, we need to comment out the following line:
allow from 127.0.0.0/255.0.0.0 ::1/128
Then we need to uncomment the line below it,
allow from all
The file should look like this:
order deny,allow deny from all # allow from 127.0.0.0/255.0.0.0 ::1/128 allow from all
Save it out and restart apache again, now try to access phpPgAdmin again. You should be able to see the site now.
[Need any further assistance with PostgreSQL errors? – We’re available 24*7]
In short, the “Forbidden” error triggers while accessing phpPgAdmin when permissions in the phpPgAdmin configuration file are not intact. Today, we saw how our Support Engineers fix this error.