0

I'm having a major problem getting phpmyadmin working again (it used to work on 16.04). I upgraded Ubuntu 16.04 to 20.04 yesterday and got the following versions of stuff:

MySQL 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64
PHP7.4-fpm
Apache 2.4.41
phpmyadmin 4:4.9.5+dfsg1-2

When I go to my usual phpmyadmin page, like "mysql.mysite.com", I receive a 503 Service Unavailable error. The rest of my websites are mostly working fine (except for non-existing php pages showing up as "No input file specified." instead of 404).

Note that my web/phpmyadmin server is SEPARATE from the MySQL server which is on a different IP and server instance (also running on Ubuntu 20.04).

Things I've read about in a variety of forums and tried, but they haven't worked:

  1. I've uninstalled and reinstalled mysql-server and phpmyadmin

  2. I've started/restarted mysql and ensured that it is running (the rest of my websites run fine)

  3. Set in my.cnf: default_authentication_plugin = mysql_native_password

  4. I've run "sudo dpkg-reconfigure phpmyadmin". Setting TCP/IP the and selected the Host name to be IP address of my database server. When I use 'root' and the admin username, I get this error: "ERROR 1045 (28000): Access denied for user 'root'@'(web-server-IP-address)'"

I have another "admin" username in MySQL, configured to be used on my web/phpmyadmin IP address, and entering the password once works, but then the program asks for it a second time, and I get this error: " ERROR 1045 (28000): Access denied for user 'phpmyadmin'@'web-server-IP-address'"

  1. In apache, I added "Include /etc/phpmyadmin/apache.conf" to /etc/apache2/apache2.conf

6 Also in apache, I added the following after " DocumentRoot /var/www/html" in 000-default.conf:

<Directory "/var/www/html">
  AllowOverride All
</Directory>

7 I also did "sudo a2enconf phpmyadmin.conf" and can confirm that it's it the conf-enabled folder, and restarted apache2.

The /etc/apache2/conf-available/phpmyadmin.conf has the following content:

#phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options SymLinksIfOwnerMatch
    DirectoryIndex index.php

    # limit libapache2-mod-php to files and directories necessary by pma
    <IfModule mod_php7.c>
        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/php/php-php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/:/usr/share/doc/phpmyadmin/:/usr/share/php/phpseclib/:/usr/share/php/PhpMyAdmin/:/usr/share/php/Symfony/:/usr/share/php/Twig/:/usr/share/php/Twig-Extensions/:/usr/share/php/ReCaptcha/:/usr/share/php/Psr/Container/:/usr/share/php/Psr/Cache/:/usr/share/php/Psr/Log/:/usr/share/php/Psr/SimpleCache/
    </IfModule>

</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
    Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
    Require all denied
</Directory>

In one of mysite.com.conf files, I have the subdomain phpmyadmin set up as:

<VirtualHost *:443>
.....
  ServerName mysql.mysite.com
  DocumentRoot /usr/share/phpmyadmin
  <Directory /usr/share/phpmyadmin>
    Options FollowSymLinks
    DirectoryIndex index.php
    AllowOverride None
  </Directory>
.....
</VirtualHost>

I've been at it for 2 days now, none of this had no effect at all and the 503 service unavailable error just persists on my mysql.mysite.com phpmyadmin page. What should I try next?

UPDATE:

I finally had success with "sudo dpkg-reconfigure phpmyadmin". I manually created the phpmyadmin user on the MySQL server and gave it all privileges to the phpmyadmin database. After running "sudo dpkg-reconfigure phpmyadmin" on the web server, it goes all the way through with the results:

dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf
phpmyadmin already exists and has privileges on phpmyadmin.
dbconfig-common: dumping mysql database phpmyadmin to 
/var/tmp/phpmyadmin.phpmyadmin.2021-04-30-04.23.mysql.VeEHd6.
dbconfig-common: dropping old mysql database phpmyadmin.
dropping database phpmyadmin: success.
verifying database phpmyadmin was dropped: success.
creating database phpmyadmin: success.
verifying database phpmyadmin exists: success.
populating database via sql...  done.
dbconfig-common: flushing administrative password

Unfortunately, I'm still stuck with a 503 service unavailable...

UPDATE 2 Narrowed things down some more. I found during a test that this will work if the DirectoryIndex is an HTML file instead of a PHP file:

<VirtualHost *:80>
  .....
  ServerName mysql.mysite.com
  DocumentRoot /usr/share/TEST   # test directory
  <Directory /usr/share/TEST>
    Options FollowSymLinks
    DirectoryIndex index.html    # index.html contains the text "test"
    AllowOverride None
  </Directory>
  .....
</VirtualHost>

However, it will not run a simple one-line index.php file, which results in a 503 Service Unavailable error. Again, the rest of my php files work on my main sites, but it's not running phpmyadmin or any php file through this subdomain setup. It seems like there is probably a really simple solution, but I just don't know enough about apache/php setups.

1 Answer 1

0

Figured it out. In case anyone else has this problem, I had to add the following block to my submdomain VirtualHost, phpmyadmin starts showing up on the subdomain again:

<FilesMatch ".php$">
  SetHandler "proxy:unix:/var/run/php/php7.4-fpm.username.sock|fcgi://localhost/"
</FilesMatch>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .