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?

  • Change the permission with sudo chown -R $USER:$USER /var/www/ and sudo chmod -R 755 /var/www – Achu Sep 19 '14 at 11:06

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 
  1. You should check /etc/apache2 and find the below lines:

    <Directory /usr/share>
        AllowOverride None
        Require all granted
  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/
    <Directory /usr/share/phpmyadmin/setup>
        <IfModule mod_authn_file.c>
            AuthType Basic
            AuthName "phpMyAdmin Setup"
            AuthUserFile /etc/phpmyadmin/htpasswd.setup
        Require valid-user
    <Directory /usr/share/phpmyadmin/libraries>
        Order Deny,Allow
        Deny from All
    <Directory /usr/share/phpmyadmin/setup/lib>
        Order Deny,Allow
        Deny from All

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

  • none of these commands have anything whatsoever to do with permissions that I can see. – Elder Geek Feb 5 '18 at 18:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.