0

localhost phpmyadmin not working

I'm trying to get phpMyAdmin to work, but it seems like it's proving to be a lot more difficult than I thought it would be.

Does anyone know what's wrong here?

BTW I'm using PHP 7 on GalliumOS (basically Ubuntu for Chromebooks).

GT.
  • 764
  • 1
  • 8
  • 30
  • 5
    Possible duplicate of [PHP code is not being executed, instead code shows on the page](http://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-instead-code-shows-on-the-page) – u_mulder Dec 03 '16 at 10:45
  • What process did you used during your LAMP installation? Your Ubuntu and Chromebook version? Any error in your *`var/log/apache2/error.log`*? – nyedidikeke Dec 03 '16 at 13:10
  • IDK I just kinda looked up tutorials online... Sorry I can't be more clear, but I'm kind of a noob and I really don't remember which exact ones I used. For the record, `localhost` itself works. I guess the problem might be with my phpmyadmin installation, then. I'll try reinstalling. – GT. Dec 03 '16 at 13:58
  • Run `sudo nano /var/www/html/info.php`, then type in ` – nyedidikeke Dec 03 '16 at 14:14
  • Thanks again, I really appreciate it. I did what you said and it says 404 not found. – GT. Dec 03 '16 at 14:20
  • If I type in `localhost/info.php` it shows ` – GT. Dec 03 '16 at 14:24
  • That's a strange result; you should check the location of the file (info.php): you must have gotten it absolutely wrong. – nyedidikeke Dec 03 '16 at 14:25
  • Hmm did you see my other comment? I might have just used the wrong ip address... I was using my public ip adress but I guess that might be different from my server ip address? – GT. Dec 03 '16 at 14:26
  • Also for the record this works: http://i.imgur.com/aGD07w7.png – GT. Dec 03 '16 at 14:27
  • Here's an image of what I see with localhost: http://i.imgur.com/ExWrN4j.png – GT. Dec 03 '16 at 14:29
  • 1
    Hey @nyedidikeke just wanted to let you know that it somehow works now! Thanks for all your help. It wasn't even working earlier this morning but I just randomly tried it again and now it works. Strange. – GT. Dec 04 '16 at 13:48

2 Answers2

1

Provided you already have PHP installed, you may resolve it by editing your /etc/apache2/apache2.conf, adding the following lines to the bottom of the file:

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

Remember to restart Apache after saving your changes.

nyedidikeke
  • 6,899
  • 7
  • 44
  • 59
  • Hey, thanks for the response! I typed in: `sudo service apache2 stop` and then `sudo service apache2 start` into my terminal and it still doesn't work... – GT. Dec 03 '16 at 13:46
  • Do you have PHP installed? Run `php -v` to check. – nyedidikeke Dec 03 '16 at 13:47
  • Yup! PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.8-0ubuntu0.16.04.3, Copyright (c) 1999-2016, by Zend Technologies – GT. Dec 03 '16 at 13:55
  • Run `sudo nano /etc/apache2/mods-enabled/dir.conf`, then, locate ` DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm ` and change the current order to `DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm`. After this, save and close the file by pressing Ctrl-X; you'll have to confirm the save by typing Y and then hit Enter to confirm so as to save the changes. Restart Apache by running `sudo systemctl restart apache2`. – nyedidikeke Dec 03 '16 at 14:06
  • Thanks nyedidikeke, I really appreciate the help, but it still doesn't work... – GT. Dec 03 '16 at 14:09
  • 1
    Thank you very much. I just add this on my `apache2.conf` working on php7.2 and solve my issue. Working very well on 2019 – Fernando Torres Jun 28 '19 at 15:27
1

I know this is a late answer, but I stumbled into the same problem, and

sudo a2enmod php7.x 

(php 7.x is the actual php version) fixed my issue (apparently php was updated and the new version was not enabled in apache)

sboda
  • 363
  • 4
  • 10