0

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

4
  • 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. Commented Dec 25, 2022 at 20:53
  • Which modules is enabled in Apache? Commented Dec 25, 2022 at 21:32
  • 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 Commented Dec 26, 2022 at 6:17
  • Found that Apache2Handler is renamed to php_module from php7_module in PHP 8.0, 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 Commented Dec 26, 2022 at 6:46

2 Answers 2

1

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 
1
  • This is probably a cleaner way of doing it, by disabling php8.1-fpm which configuration can be found in the apache2/conf-available folder. Commented Oct 16, 2023 at 19:02
0

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.