Score:0

Stuck on php8.1 when downgrading to php7.4

ba flag

I upgraded the php version on my Apache server running on Debian (buster) from 7.3 to 8.1. Due to an older Nextcloud installation I had to downgrade to php7.4. The downgrade worked well following instructions like this, but the server is still reporting it is on the previous version 8.1.13. I placed a simple phpversion() file to check out the server version and the Nextcloud installation is complaining of the incorrect version. Is this a cache issue or some configuration file which has to be modified manually?

  • CLI: php -v returns PHP 7.4.33 (cli) (built: Nov 8 2022 11:35:02) ( NTS )
  • php -c /etc/php/apache2/php.ini -v reads PHP 7.4.33
  • update-alternatives --config php shows * 2 /usr/bin/php7.4 74 manual mode
  • Added php7.4 module via sudo a2enmod php7.4
  • Removed all other php modules via sudo a2dismod phpX.Y
  • /etc/apache2/mods-enabled/ looks like this:

access_compat.load autoindex.load mime.load reqtimeout.load alias.conf deflate.conf mpm_prefork.conf rewrite.load alias.load deflate.load mpm_prefork.load setenvif.conf auth_basic.load dir.conf negotiation.conf setenvif.load authn_core.load dir.load negotiation.load socache_shmcb.load authn_file.load env.load php7.4.conf ssl.conf authnz_external.load filter.load php7.4.load ssl.load authz_core.load headers.load proxy.conf status.conf authz_host.load http2.conf proxy_fcgi.load status.load authz_user.load http2.load proxy.load unique_id.load autoindex.conf mime.conf reqtimeout.conf

phpinfo readout can be found here

cc flag
Debian Buster shipped with PHP 7.3, so it's unclear how you had PHP 7.1, 7.4 or 8.1. You need to add more information to your question, because there is more going on that you have not properly described.
vidarlo avatar
ar flag
Which modules is enabled in Apache?
droid001 avatar
ba flag
I supplemented the question after the above comments. The previous version was indeed 7.3 now that I looked at the options with `update-alternatives --config php`
droid001 avatar
ba flag
Found that [Apache2Handler is renamed to php_module from php7_module in PHP 8.0](https://php.watch/versions/8.0/mod_php-rename), but when I ran `grep -r php_module` in `/etc/apache2` I only found files in the mods_avalable directory: ```mods-available/php8.0.load:LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so mods-available/php8.1.load:LoadModule php_module /usr/lib/apache2/modules/libphp8.1.so ```
Score:0
aq flag

For me I also had to disable the php8.1-fpm configuration file

sudo a2disconf php8.1-fpm

and then reload apache2

sudo systemctl reload apache2
Score:0
ba flag

Even how I dislike answering my own question, I did find a way out of this problem. I ran

apt purge '^php8.1.*'

,restarted the server and got an earlier version of php running. It would still be interesting to know why the server chose the latest version and not the one it was oppose to point to via update-alternatives --config php.

I sit in a Tesla and translated this thread with Ai:

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.