When I tried accessing phpmyadmin on a CentOS 7 server running the Apache webserver software using http://example.com/phpmyadmin, I received the message below:
You don't have permission to access /phpmyadmin on this server.
I got the same error if I tried using the IP address of the system instead of example.com.
I could see the phpMyAdmin files on the system in
/usr/share/phpMyAdmin and the rpm command showed
the package for it was installed on the system.
# rpm -qa | grep Admin phpMyAdmin-4.3.6-1.el7.noarch
And when I logged into the web server, opened a browser, and pointed it to http://localhost/phpmyadmin, I was able to get the phpMyAdmin login prompt. I could also get to the setup page at http://localhost/phpmyadmin/setup. I still received the "forbidden" error message if I tried the IP address of the system in the address bar of the browser while logged into the system, though.
I encountered the same error message about 4 years ago as noted in Installing phpMyAdmin on a CentOS System Running Apache. In that case my notes indicated I edited the phpmyadmin.conf file to add access from an additional IP address. But when I looked for a phpadmin.conf file on the current system, there was none to be found. After a little further investigation, though, I found I should have been looking for phpMyAdmin.conf rather than phpmyadmin.conf. I.e., I needed to look for a file with a capital "M" and "A" in the file name.
# locate phpMyAdmin.conf /etc/httpd/conf.d/phpMyAdmin.conf
I then added
192.168 after the instances of the
127.0.0.1, in the
Directory /usr/share/phpMyAdmin/ section of
/etc/httpd/conf.d/phpMyAdmin.conf as shown
below, since the other systems on the LAN
had addresses in the 192.168.xxx.xxx range, so I could access
phpMyAdmin from any other system on the LAN.
<Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 192.168 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 192.168 Allow from ::1 </IfModule> </Directory>
I then restarted the Apache web server software by running
restart from the root account. I was then able to access phpMyAdmin
using the internal IP address of the system, e.g.,
http://192.168.0.5/phpmyadmin, though http://example.com/phpmyadmin didn't work
because even though I was trying to access the server from a system on
the same LAN by using the
qualified domain name (FQDN), I was then accessing the system by the
external address on the outside of the firewall/router it sits behind. But,
in this case, accessing it by IP address was sufficient.