3

I'm running Ubuntu 16.04 on Virtualbox. I install apache2.4.18, php7.0.8, libapache2-mod-php7.0, mysql5.7.16 and phpMyAdmin(4:4.5.4.1-2ubuntu2).

When I type localhost/phpmyadmin in the browser (Firefox), I get lots of code instead of the web page for phpMyAdmin. What could be the source of the problem?

Here's a screenshot

Edit: phpinfo() is working, but phpMyAdmin is not.

Also I tried typing these commands in the terminal: "a2query -m php7.0" "a2enmod php7.0" They showed that php is enabled.

phpinfo

1
  • On kubuntu 21.10 - follow same instructions as in question above and answer below, but use php version 8.0 (not 7.0)
    – ATutorMe
    Jan 27 at 2:01

3 Answers 3

5

I was facing the exact same problem and it was solved for me by doing this:

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.0-fpm
sudo service apache2 restart

How and Why: This happens when PHP7 doesn't configure the default fast-CGI service in the make script. sudo a2enmod proxy_fcgi setenvif creates three new mods

  1. /mods-available/proxy.conf
  2. proxy_fcgi.load
  3. proxy.load

Likewise, sudo a2enconf php7.0-fpm creates a config file /conf-available/php7.0-fpm.conf Once this is done and Apache2 can then run the PHP7 module as a fast-CGI service

Source

0

Is php properly configured? It sounds like it isn't.

Try creating a php file with the following content, and see if it renders:

<?php

phpinfo();

?>
4
  • 1
    phpinfo() is working, but phpMyAdmin is not.
    – Matias
    Dec 17, 2016 at 7:11
  • 1
    Also I tried typing these commands in the terminal: "a2query -m php7.0", and "a2enmod php7.0" in the terminal. They showed that php is enabled.
    – Matias
    Dec 17, 2016 at 7:17
  • @Matias These two comments are helpful and they should also be added to your question. To edit your question click this link: askubuntu.com/posts/861493/edit
    – karel
    Dec 17, 2016 at 7:27
  • @Matias Would you share your apache config files? That could help.
    – Ben Yanke
    Dec 17, 2016 at 16:52
0

Looks like php is not installed?

Here's the command to install php.

sudo apt-get install php

If you're still having issues, reconfigure phpmyadmin, and then reload apache.

sudo dpkg-reconfigure phpmyadmin
sudo service apache2 reload

I typically run sudo apt-get install lamp-server^

This command will install latest packages for apache, php, and other dependencies needed for web apps such as phpmyadmin, wordpres..etc. I highly recommend purging everything and run that command.

3
  • Thanks, but I want to build the lamp server from scratch.
    – Matias
    Dec 17, 2016 at 7:18
  • I have updated my answer with troubleshooting steps.
    – CeFu
    Dec 17, 2016 at 7:23
  • I tried "sudo dpkg-reconfigure phpmyadmin", but it didn't help.
    – Matias
    Dec 17, 2016 at 7:52

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.