0

I'm having a tough time trying to fix a major problem getting phpmyadmin working again (it used to work on ubuntu 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 pages, like "mysql.mysite.com", I receive a 503 Service Unavailable error. The rest of my websites are mostly working fine. However, the sub-domains connected with phpmyadmin are broken.

My server is now set up with php7.4-fpm using pool.d sockets for each of my usernames to use. It used to be that way before with php7.0-fpm. When I completed the update, none of the sites worked and I had to work through the middle of the night as an emergency just to get the main website domains partially working again (which I was eventually able to do as described below).

In my website.com.conf on apache, I used to have something like:

<VirtualHost *:80>

<IfModule mod_fastcgi.c>
  AddHandler php7-fcgi-username .php
  Action php7-fcgi-username /php7-fcgi-username
  Alias /php7-fcgi-username /usr/lib/cgi-bin/php7-fcgi-username
  FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-username -socket /run/php/php7.4-fpm.username.sock -idle-timeout 300 -pass-header Authorization
  <Directory "/usr/lib/cgi-bin">
    Require all granted
  </Directory>
</IfModule>

....
<IfModule mod_fastcgi.c>
  <FilesMatch ".+\.ph(p[3457]?|t|tml)$">
    SetHandler php7-fcgi-username
  </FilesMatch>
</IfModule>

</VirtualHost

Now I have something like the following, and each of the main websites now work:

<VirtualHost *:80>

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

</VirtualHost>

For my subdomains (which I haven't been able to get working), I have a block of code similar to:

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

As a test, I even tried something like:

<VirtualHost *:80>
  .....
  ServerName mysql.mysite.com
  DocumentRoot /usr/share/TEST   # test directory
  <Directory /usr/share/TEST>
    Options FollowSymLinks
    DirectoryIndex index.php    # index.php contains one line of code: echo "test";
    AllowOverride None
  </Directory>
  .....
</VirtualHost>

With the index.php file having a single line of code to use as a test, but I'm still getting a 503 Service Unavailable error.

In addition, I have the following mods enabled:

access_compat.load authn_core.load autoindex.load filter.load mpm_event.load proxy.load security2.load status.conf actions.conf authn_file.load deflate.conf headers.load negotiation.conf proxy_wstunnel.load setenvif.conf status.load actions.load authz_core.load deflate.load http2.load negotiation.load reqtimeout.conf setenvif.load unique_id.load alias.conf authz_host.load dir.conf mime.conf proxy.conf reqtimeout.load socache_shmcb.load userdir.conf alias.load authz_user.load dir.load mime.load proxy_fcgi.load rewrite.load ssl.conf userdir.load auth_basic.load autoindex.conf env.load mpm_event.conf proxy_http.load security2.conf ssl.load

I also have the following confs enabled:

charset.conf javascript-common.conf localized-error-pages.conf other-vhosts-access-log.conf php5.6-fpm.conf php7.4-fpm.conf security.conf serve-cgi-bin.conf

I'm hoping someone with a bit more experience with this kind of thing can offer some advice.

UPDATE 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.

SOLVED In case anyone else has this problem, I had to add the following block to my submdomain VirtualHost:

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

1 Answers1

0

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>
peppy
  • 73
  • 2
  • 10