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

I installed php, mysql, phpmyadmin on my Ubuntu 12.04 localhost in the following steps:

I try these steps:

sudo apt-get install apache2
sudo /etc/init.d/apache2 restart
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install php5-cli
sudo apt-get install php5-cgi
sudo apt-get install php5-mysql
sudo apt-get install php5-pgsql
sudo /etc/init.d/apache2 restart

than after i faced phpmyadmin not found error and fixed using the following answer

How to solve the phpmyadmin not found issue after upgrading php and apache?

After applying that fix I got another error message:

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

How can fix this?

1

6 Answers

It solved :

sudo apt-get install mysql-server
sudo dpkg-reconfigure phpmyadmin
sudo service apache2 restart

You need to change the permission with:

sudo chown -R $USER:$USER /var/www/
sudo chmod -R 755 /var/www 
0
  1. You should check /etc/apache2 and find the below lines:

    <Directory /usr/share> AllowOverride None Require all granted
    </Directory>
  2. the apache2 config should have this line:

    Include /etc/phpmyadmin/apache.conf
  3. Be you you phpadmin config look like this:

    Alias /phpmyadmin /usr/share/phpmyadmin
    <Directory /usr/share/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_admin_flag allow_url_fopen Off php_value include_path . php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/ </IfModule>
    </Directory>
    <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>
    <Directory /usr/share/phpmyadmin/libraries> Order Deny,Allow Deny from All
    </Directory>
    <Directory /usr/share/phpmyadmin/setup/lib> Order Deny,Allow Deny from All
    </Directory>

The solution for me, was to uncomment the following lines:

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

in /etc/apache2/apache2.conf.

I faced the issue when I installed PHPMyAdmin in Ubuntu OS 16.04. I fixed the issue by adding the line [Require all granted] in the Directory section.

Example:

<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 </IfModule>
</Directory>

This worked for me in centos removing unnecessary backup files of configuration

[root@Stats-Server-1 etc]# cd httpd/

[root@Stats-Server-1 httpd]# ls conf conf.d conf.modules.d logs modules run

[root@Stats-Server-1 httpd]# sudo nano conf.d

[root@Stats-Server-1 httpd]# cd conf.d

[root@Stats-Server-1 conf.d]# ls

autoindex.conf phpMyAdminbk.conf phpMyAdmin.conf.rpmsave userdir.conf php.conf phpMyAdmin.conf README welcome.conf

[root@Stats-Server-1 conf.d]# rm -rf phpMyAdminbk.conf

[root@Stats-Server-1 conf.d]# rm -rf phpMyAdmin.conf.rpmsave

[root@Stats-Server-1 conf.d]# sudo systemctl restart httpd.service

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like