Sometimes Website Administrators and users complain that they get a "403 forbidden" message while they try to access phpPgAdmin.
Generally, the 403 Forbidden Error happens when the web page (or other resource) that you're trying to open in your web browser is a resource that you're not allowed to access. Also it can trigger when Website Administrators have improperly set up permissions and you're getting denied access when you really shouldn't be.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related phpPgAdmin queries.
In this context, we shall look into how to fix this phpPgAdmin permission error.
What triggers "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:
You don't have permission to access /phppgadmin/ on this server
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.
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.
To implement 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
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:
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 urgent assistance in fixing PostgreSQL errors? – We're available 24*7. ]