Apache 2 and phpmyadmin on VirtualHost on custom port: you don't have permissions to access /phpmyadmin on this server

7,412

I am not an Apache expert but in your /etc/httpd/conf/httpd.conf have you tried adding the following?

<Directory "/usr/local/apache2/phpmyadmin/">
Options All
AllowOverride All
Require all granted
</Directory>

There is a new permission model in Apache2 where the following is default:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

So you have to specifically add exceptions for your directories. You can read more about it here

Share:
7,412

Related videos on Youtube

nikis
Author by

nikis

https://github.com/elect86/ https://github.com/kotlin-graphics

Updated on September 18, 2022

Comments

  • nikis
    nikis over 1 year

    I googled a lot but I did not find a guide to set up phpmyadmin on a virtualHost on a custom port.

    Apache 2.4, this is my httpd-vhosts.conf

    Listen 0.0.0.0:66
    
    <VirtualHost *:66>
    Alias /phpmyadmin /usr/local/apache2/phpmyadmin
    <Directory "/usr/local/apache2/phpmyadmin">
        Options FollowSymLinks
        DirectoryIndex index.php
    
        <IfModule mod_php5.c>
            AddType application/x-httpd-php .php
    
            php_flag magic_quotes_gpc Off
            php_flag track_vars On
            php_flag register_globals Off
            php_value include_path .
        </IfModule>
    
    </Directory>
    # Authorize for setup
    <Directory /usr/share/phpmyadmin/setup>
     <IfModule mod_authn_file.c>
     AuthType Basic
     AuthName "phpMyAdmin Setup"
     AuthUserFile /etc/phpmyadmin/htpasswd.setup
     </IfModule>
     Require valid-user
    </Directory>
    #Disallow web access to directories that don't need it
    <Directory /usr/share/phpmyadmin/libraries>
       Order Deny,Allow
       Deny from All
    </Directory>
    <Directory /usr/share/phpmyadmin/setup/lib>
      Order Deny,Allow
      Deny from All
    

    And this is the error in the logs

     [Thu Jul 05 17:45:49.322954 2012] [authz_core:error] [pid 14314:tid 139825756501760] [client 127.0.0.1:49262] AH01630: client denied by server configuration: /usr/local/apache2/phpmyadmin/
    

    And these are the privileges

    /usr/local/apache2# ls -l
    insgesamt 60
    drwxr-sr-x  2 root staff  4096  6. Jun 18:40 bin
    drwxr-sr-x  2 root staff  4096  6. Jun 18:40 build
    drwxr-sr-x  2 root staff  4096  6. Jun 18:40 cgi-bin
    drwxr-sr-x  4 root staff  4096  5. Jul 17:04 conf
    drwxr-sr-x  3 root staff  4096  6. Jun 18:40 error
    drwxr-xr-x  2 root staff  4096  5. Jul 17:03 htdocs
    drwxr-sr-x  3 root staff  4096  6. Jun 18:40 icons
    drwxr-sr-x  2 root staff  4096  6. Jun 18:40 include
    drwxr-sr-x  2 root staff  4096  5. Jul 17:44 logs
    drwxr-sr-x  4 root staff  4096  6. Jun 18:40 man
    drwxr-xr-x 14 root staff 12288  6. Jun 17:55 manual
    drwxr-sr-x  2 root staff  4096 24. Jun 18:03 modules
    drwxr-sr-x  8 root staff  4096  5. Jul 17:42 phpmyadmin
    
  • nikis
    nikis almost 12 years
    Cool, it worked like a charm, I just needed also to open the port itself on the firewall and it went. Thanks Nic :)
  • Admin
    Admin almost 12 years
    @elect I am glad it worked out.