1
votes

I just installed phpMyAdmin on my Virtual Private Server, but I can't access it from my browser to set it up. I verified that the folder permissions on /phpmyadmin are the same as my public_html folder.

When I go to url (http://www.testsite.com/phpmyadmin) I get a 403 error "You don't have permission to access /phpmyadmin on this server. Apache/2.2.15 (CentOS) Server at www.testsite.com Port 80"

I then go to my /var/log/httpd/error.log and see an entry for the denied access (note I partially replaced my IP address with x's) [Thu Oct 29 19:12:46 2015] [error] [client xx.xxx.68.18] client denied by server configuration: /usr/share/phpMyAdmin

I then edit /etc/httpd/conf.d/phpMyAdmin.conf which has the following lines

<Directory /usr/share/phpMyAdmin/>
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</Directory>

In each section of code listed above, I add just below Allow from ::1

Allow from xx.xxx.68.18

I'm still getting the same 403 error. I would appreciate some insights and direction to fix this issue. Thanks

2

2 Answers

5
votes

If you have installed phpMyAdmin in your linux server (centos/RHEL/debian), and tried to access phpMyAdmin in most cases you will get this 403 forbidden error. I have seen this issue very often if you are installing phpmyadmin using yum or by apt-get. By default phpmyadmin installed path is /usr/share/phpmyadmin and the apache configuration file is located in /etc/httpd/conf.d/phpmyadmin.conf.

Forbidden You don't have permission to access /phpmyadmin/ on this server.

To fix:

nano /etc/httpd/conf.d/phpmyadmin.conf

Remove or comment the first two lines in below.

#Order Allow,Deny
#Deny from all
Allow from 127.0.0.1

Restart the apache server.

service httpd restart
1
votes

I was running into the same issue with a new install of Fedora 25, Apache, MariaDB and PHP.

The router is on 192.168.1.1 and the Fedora 25 server is sitting at 192.168.1.100 which is a staic address handed out by the router. The laptop was getting a random ip in the range of 192.168.1.101 to 150.

The change I made to the /etc/httpd/conf.d/phpMyAdmin.conf was instances of

Require ip 127.0.0.1

to

Require ip 127.0.0.1 192.168.1.1/24

This worked for me. The idea came from the process of inserting the ip address of the laptop into the .conf file behind the reference to 127.0.0.1 and I was able to get access.

So instead of doing the more secure thing of handing out a static ip address to the laptop I let the phpMyAdmin.conf file open to a range of ip address on the local subnet, if that is the right terminology.

If there are drawbacks to doing this let me know so that I can make the appropriate changes.