Question

Access to phpMyAdmin on Centos7 suddenly stopped working after server reboot.

Posted December 10, 2015 11.7k views
CentOS Apache LAMP Stack

I set up my Centos7 server about 2 months ago.

phpMyAdmin has been working fine. Yesterday I stopped and restarted the server. Now everything else appears fine, but when I try and access phpmyadmin I get the browser message:

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

I have googled extensively and as far as I can see, everything is set up correctly.

My phpMyAdmin.conf file contains (relevant parts only):

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
      #   Require ip 127.0.0.1
       # Require ip ::1
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     #Deny from All
     #Allow from 127.0.0.1
     #Allow from ::1
     allow from all
     Require all granted
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
        #  Require ip 127.0.0.1
       # Require ip ::1
       Require all granted  
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     allow from All
     # Allow from 127.0.0.1
     # Allow from ::1
   </IfModule>
</Directory>

http.conf contains:

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

I do have an index.php file in /var/www.html.

Whenever I attempt to access phpMyAdmin, my apache error log shows

Cannot serve directory /usr/share/phpMyAdmin/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

I have definitely stopped and restarted Apache, rebooted the server etc, and nothing has improved.

All ideas welcome.

edited by asb

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

This is likely due to a permissions misconfiguration, or potential ownership issues with the /usr/share/phpMyAdmin/ folder or your /var/www/html/ folder. The logs are likely in /var/log/ and should indicate more specifically what the error is, but this guide should also be very helpful for both configuration and security - https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-16-04

by Brennen Bearnes
While many users require access to a database management system like MySQL, not all users feel comfortable interacting with the MySQL prompt on a daily basis. In this guide, we'll discuss how to install and secure phpMyAdmin, a web management interface for MySQL, on an Ubuntu 16.04 server.
Submit an Answer