I have installed phpmyadmin, then I added this line to /etc/apache2/apache2.conf :

Include /etc/phpmyadmin/apache.conf

and save it. After that, I ran this command :

sudo ln -s /usr/share/phpmyadmin /var/www

But it is still not working. Help me please :)

When I browse to phpmyadmin in my browser in get the source code, see the image below.

enter image description here

  • did you followed a particular tutorial? and how you're accessing phpmyadmin from browser? – bistoco Jan 20 '18 at 4:39
  • I think that sum link should have been /var/www/html. Apache root should be /var/www/html – George Udosen Jan 20 '18 at 8:16
  • yes, i have linking to /var/www/html – Arian saputra Jan 21 '18 at 12:47

In Ubuntu 16.04.3 LTS you can follow these steps to install Apache2, MySQL, PHP7 and phpmyadmin, I tested this today and it shouln't give you any kind of problems, maybe you missed one of these steps, so please check them out:

  1. Install Apache2:

    sudo apt update

    sudo apt install apache2

  2. Edit the file /etc/apache2/apache2.conf, add the following line at the end:

    ServerName <yourDomainOrIP>

  3. Check if your config is OK:

    sudo apache2ctl configtest

    The output should be like this: Syntax OK

  4. Restart Apache to implement changes:

    sudo systemctl restart apache2

  5. Verify if Apache is working, open you browser and go to: http://your_ip_address, you should see somehing like the following image:

    Apache Works

  6. Install MySQL:

    sudo apt install mysql-server

    During this installation you will be asked to enter the MySQL password.

  7. Secure your MySQL installation executing:

    sudo mysql_secure_installation

    Choose the options that you prefer in this step.

  8. Install PHP:

    sudo apt install php libapache2-mod-php php-mcrypt php-mysql

  9. Edit the file /etc/apache2/mods-enabled/dir.conf, after editing it should look like this:

    <IfModule mod_dir.c>
        DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
  10. Restart Apache and check its status:

    sudo systemctl restart apache2

    sudo systemctl status apache2

    After this step if you want to install PHP modules, you can search for them using:

    apt-cache search php- | less

  11. Test if PHP works, create an info.php:

    sudo nano /var/www/html/info.php

    An put the following content inside:

    <?php phpinfo(); ?>

    Now go to http://your_ip_address/info.php and you should see something like the image below:

    PHP Info

  12. Install phpmyadmin:

    sudo apt install phpmyadmin php-mbstring php-gettext

    During the installation you will be asked to choose your web server (apache2) and if you want to use dbconfig-common to configure the db, finally the password for phpmyadmin will be requested.

    This process adds phpmyadmin to /etc/apache2/conf-enabled/, you can verify it with: ls /etc/apache2/conf-enabled/

    ls /etc/apache2/conf-enabled/

  13. Enable PHP mcrypt and mbstring:

    sudo phpenmod mcrypt

    sudo phpenmod mbstring

  14. Restart Apache again and test if everything works.

    sudo systemctl restart apache2

    Go to http://your_ip_address/phpmyadmin and you will see the login page:

    phpmyadmin Login screen

    Enter your credentials and then you're done:

    phpmyadmin databases

Hope it helps.

  • my ubuntu version is 17.04 – Arian saputra Jan 21 '18 at 12:44
  • Good to hear that it worked, If you find this answer useful you may "accept" it (by clicking on the tick mark (✓) next to it) so others may more easily find it in the future, also you can upvote the answer. =) – galoget Jan 23 '18 at 5:01

I was facing the somewhat same problem because I have created a symlink of a website in the following directory: /etc/apache2/sites-enabled/ due to which it was blocking phpmyadmin from loading using localhost/phpmyadmin in the browser. I have removed the symlink from the directory using the following command: rm somefilename.com.conf. Use the name of your symlink instead of somefilename in the above command. Do not remove the default symlink from the folder.

You can see errors caused by apache2 using the following command: sudo apache2ctl configtest

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.