+ 1
How to change PHP version to work with Apache server in Linux
To evaluate compatibility and advantages of more recent PHP versions for different webpages, I want to be able to switch between different PHP versions within Apache on my local computer. I run Debian 'Bullseye' on my machine and have already installed different PHP versions in parallel. What configuration do I need to adjust to switch between PHP versions?
3 Answers
0
Thanks FF9900!
It seems like your recommended reading contains the technically best solution. It advices to create virtual hosts and use them with PHP-FPM.
The later should also improve performance.
But for now I'm happy with the simpler solution, which I meanwhile found searching the net:
Simply tell the Apache server to disable the currently used PHP version and afterwards enable the desired one, e.g.:
a2dismod php7.4
a2enmod php8.1
Finally restart the Apache server:
systemctl restart apache