Score:0

Ubuntu 18.04: PHP stopped working after I tried to fix phpmyadmin

in flag

I have a problem with a Ubuntu 18.04.6 Ubuntu server. I was trying to fix a problem with phpMyAdmin (a lot of errors appearing on screen, and preventing me to use it, pointing to some authorization error). What I did is:

  • I tried to reinstall phpMyAdmin (failed because of this error access denied for user 'debian-sys-maint '@' localhost using password 'yes')
  • I fixed the authorization issue
  • I reinstalled phpMyadmin successfully, but was not working (I could the the php code in the browser)
  • I realized that something might have happen with apache/php config, and tried to fix it
  • I could see php7.4 module enabled in apache config but trying to restart the service I had an error
  • I tried to upgrade and then reinstall php (using `apt-get'), and everything looked ok
  • Trying to re-enable php7.4 resulted in an apache error, but enabling php8 instead of php7.4 seemed to be working but...
  • Now it I open any website that uses php on my server, I can only see a blank page.

I tried to check the content of the error logs for each website, but they are not updated. I checked `/var/log/php_errors.log but it is empty.

At the moment the server is unusable, and I cannot find any hint on how to solve the problem.

Can someone please point me in the right direction? Maybe it's just a matter of reinstalling everything, but at this point I'm not sure I know what to do.

Thank you in advance.

EDIT

After posting this question I continued playing with it. At the end I completely removed the older versions of php and reinstalled php8, and php8-mysql and a lot of other packages and I've been able to restore the functionality of php and apache.

I also reinstalled phpmyadmin, the installation went ok without any error, but I cannot access it. I found this article https://docs.bitnami.com/general/faq/get-started/access-phpmyadmin/, I suppose that now the only thing missing is enabling the SSH tunnel, I suppose that older versions of phpMyAdmin didn't need this.

EDIT (2)

I've found the apache logs, but I honestly cannot understand them. When I access /phpmyadmin on the server, these lines get written:

[Mon Nov 08 08:47:44.650203 2021] [core:error] [pid 16470] [client 31.14.41.57:40086] AH10244: invalid URI path (/cgi-bin/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/bin/sh)
[Mon Nov 08 08:47:44.703164 2021] [core:error] [pid 16474] [client 31.14.41.57:40090] AH10244: invalid URI path (/cgi-bin/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/%%32%65%%32%65/bin/sh)
[Mon Nov 08 08:47:44.755659 2021] [core:error] [pid 16470] [client 31.14.41.57:40092] AH10244: invalid URI path (/icons/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/bin/sh)
[Mon Nov 08 08:47:44.807909 2021] [core:error] [pid 16474] [client 31.14.41.57:40096] AH10244: invalid URI path (/icons/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/bin/sh)
[Mon Nov 08 08:47:44.860247 2021] [core:error] [pid 16470] [client 31.14.41.57:40098] AH10244: invalid URI path (/cgi-bin/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/bin/sh)
[Mon Nov 08 08:47:44.912659 2021] [core:error] [pid 16474] [client 31.14.41.57:40102] AH10244: invalid URI path (/cgi-bin/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/bin/sh)
[Mon Nov 08 08:47:44.965121 2021] [core:error] [pid 16470] [client 31.14.41.57:40104] AH10244: invalid URI path (/icons/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/bin/sh)
[Mon Nov 08 08:47:45.017634 2021] [core:error] [pid 16474] [client 31.14.41.57:40108] AH10244: invalid URI path (/icons/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/bin/sh)
[Mon Nov 08 08:47:45.070238 2021] [core:error] [pid 16470] [client 31.14.41.57:40110] AH10244: invalid URI path (/cgi-bin/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/bin/sh)
[Mon Nov 08 08:47:45.123221 2021] [core:error] [pid 16474] [client 31.14.41.57:40114] AH10244: invalid URI path (/cgi-bin/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/bin/sh)
eg flag
If you haven't installed the Bitnami package, then you aren't restricted by the explanation from their manual; that seems to be some extra step they take to secure your installation. "I cannot access it" please describe in more detail what error you get, what is in the webserver error logs, and which URL you're trying to access; we aren't very good at guessing what the messages say :)
in flag
Post your configuration and actual error messages. A vague description doesn't help.
djdomi avatar
za flag
php does not use afaik this user by default. verify that the user has still the password and try to log in via root or other admin user
in flag
@ibennetch I can't see any error. If I connect to my page //server/phpmyadmin I get a blank page, and cannot find where to search for error logs. /var/log/apache2 does not contain anything that I can relate to phpmyadmin, and searching google I haven't been able to understand where phpmyadmin logs are stored.
eg flag
Since phpMyAdmin is a web application, it just logs errors in the same place your webserver is configured to send logs (which by default on Ubuntu should be `/var/log/apache2/error.log`, unless you've changed it or added your own VirtualHost with corresponding ErrorLog directives). Are you able to try accessing it from another computer or with private browsing mode, to bypass any lingering cookies or cache issues?
in flag
Thanks for your help, I've updated my answer with the logs, but it's honestly incomprehensible to me...
eg flag
@simonelippolis Those log lines unfortunately have nothing to do with phpMyAdmin, it looks like someone is trying to exploit generic server weaknesses to get access to your server (`/cgi-bin/` sometimes is configured to run executable files,`/bin/sh` is one of the shell programs). Those attacks are often sent to any webserver an attacker can find and don't automatically mean you're specifically under attack. Probably the phpMyAdmin part of the log file is obscured by that, you might try `grep -i phpmyadmin /var/log/apache2/error.log` to search for only phpMyAdmin errors.
in flag
Thanks again. The apache error log contains just a few lines of that error, nothing related to phpmyadmin. I think that it is not logging, maybe it is simply not running...
Score:-1
cn flag

First, I recommend you to use phpMyAdmin within a Docker Container in order to keep your system clean ! :)

Secondly, for your php problem, I suggest you to restore the older php installation in order to get all your website up again. So, you can try to uninstall phpmyadmin, uninstall php, reinstall it with the previous version and then pray for it's working.

Maybe you have to recover a php.ini file somewhere, I don't know, it depends of your administration.

You can even try to verify that your apache2 is running fine with sudo systemctl status apache2

Hope you'll find a solution

Nikita Kipriyanov avatar
za flag
It isn't "natively installed". Both lxc/lxd and Docker bring *a lot* of unusual and otherwise unneeded requirements and complications. I can easily configure web server so when I destroy phpmyadmin or anything else other applications don't notice anything. It's like with Docker, but without it and its requirements. Just cleaner and much easier. Don't bring a complexity where it is not needed. Docker is *bad* when you need just add another application into a busy running system. It is good for *automatic deployment of swarms of similar processing nodes* and hardly usable for anything else.
Nikita Kipriyanov avatar
za flag
Using Docker just for PHPMyAdmin is clearly more dirty than to install it directly. Clean, nothing except the requried software, isn't it?
cn flag
Docker or other plateforme of containerisation, like lxc who's natively installed on popular Linux systems, there's no overkill because it's just some segmentation of applications ; you can destroy your phpmyadmin without touching other running websites :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.