我需要在Ubuntu 20.04上将PHP版本从8.0切换到7.4。我尝试运行以下命令(但没有成功):
sudo a2dismod php8.0
sudo a2enmod php7.4
sudo service apache2 restart
当我打开一个本地网页并运行 PHP info
<?php phpinfo(); ?>
,PHP 版本仍然是 8.0.3 而不是 7.4。请注意,当我执行命令
sudo a2enmod php7.4
时,我会得到以下输出:dan@dan:~$ sudo a2enmod php7.4
Considering dependency mpm_prefork for php7.4:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Enabling module mpm_prefork.
Considering conflict php5 for php7.4:
Enabling module php7.4.
To activate the new configuration, you need to run:
systemctl restart apache2
也许这就是问题的根源?