'how i can disable php 8 and enable php7.4 in arch linux

when I run the command php -v I have version 8.0 I would like to change the version to 7.4 despite I have installed php7.4 but I don't know how to switch between the two versions

thank you



Solution 1:[1]

As your question is about the Arch Linux and it doesn't have the a2enmod & a2dismod. I am gonna providing working answer in the arch:

I assume you have installed php7 & php8 and just want to make apache to use the version 7.

first uninstall apache-php module and install the right one.

sudo pacman -R php-apache  
sudo pacman -S php7-apache

then in the /etc/httpd/conf/httpd.conf change the module name:

from :

LoadModule php_module modules/libphp.so
Include conf/extra/php_module.conf
AddHandler php-script php

to:

LoadModule php7_module modules/libphp7.so
Include conf/extra/php7_module.conf
AddHandler php7-script php

after that you can reload the server:

sudo systemctl reload httpd

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1