I'm trying to switch php versions, get following response. I tried dismounting mpm_prefork and mpm_worker still no joy, any ideas please.on Ubuntu 16.04 sudo a2enmod php5.6 Considering dependency mpm_prefork for php5.6: Considering conflict mpm_event for mpm_prefork: Considering conflict mpm_worker for mpm_prefork: Enabling module mpm_prefork. Considering conflict php5 for php5.6: Enabling module php5.6. To activate the new configuration, you need to run: service apache2 restart 解决方案 Your commands looks correct. Did you restart apache before testing?sudo service apache2 restartThe PHP module php5.6 made by Ondřej Surý can only be enabled by:sudo a2dismod php7.0sudo a2dismod php7.1sudo a2dismod php7.2sudo a2dismod php7.3sudo a2dismod php7.4sudo a2enmod php5.6sudo update-alternatives --set php /usr/bin/php5.6sudo service apache2 restartI have found that this setup isn't compatible with any other MPM modules other that PREFORK. You have to make sure you disable ALL other MPM modules first, before enabling the php5.6 mod.If the mod won't enable you might have to try to disable the other MPM's.sudo a2dismod mpm_preforksudo a2dismod mpm_workersudo a2dismod mpm_eventThen try to enable the mod again as it should auto enable the correct MPM.$ sudo a2enmod php5.6Considering dependency mpm_prefork for php5.6:Considering conflict mpm_event for mpm_prefork:Considering conflict mpm_worker for mpm_prefork:Module mpm_prefork already enabledConsidering conflict php5 for php5.6:Enabling module php5.6.To activate the new configuration, you need to run: service apache2 restartFYI, I like to put these commands into my '.bash_aliases' so I always have them handy for DEV work.# Aliases - PHPalias php.info='php -i'alias php5.6='sudo a2dismod php7.0 && sudo a2dismod php7.1 && sudo a2dismod php7.2 && sudo a2dismod php7.3 && sudo a2dismod php7.4 && sudo a2enmod php5.6 && sudo update-alternatives --set php /usr/bin/php5.6 && sudo service apache2 restart'alias php7.0='sudo a2dismod php5.6 && sudo a2dismod php7.1 && sudo a2dismod php7.2 && sudo a2dismod php7.3 && sudo a2dismod php7.4 && sudo a2enmod php7.0 && sudo update-alternatives --set php /usr/bin/php7.0 && sudo service apache2 restart'alias php7.1='sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2dismod php7.2 && sudo a2dismod php7.3 && sudo a2dismod php7.4 && sudo a2enmod php7.1 && sudo update-alternatives --set php /usr/bin/php7.1 && sudo service apache2 restart'alias php7.2='sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2dismod php7.1 && sudo a2dismod php7.3 && sudo a2dismod php7.4 && sudo a2enmod php7.2 && sudo update-alternatives --set php /usr/bin/php7.2 && sudo service apache2 restart'alias php7.3='sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2dismod php7.1 && sudo a2dismod php7.2 && sudo a2dismod php7.4 && sudo a2enmod php7.3 && sudo update-alternatives --set php /usr/bin/php7.3 && sudo service apache2 restart'alias php7.4='sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2dismod php7.1 && sudo a2dismod php7.2 && sudo a2dismod php7.3 && sudo a2enmod php7.4 && sudo update-alternatives --set php /usr/bin/php7.4 && sudo service apache2 restart'GIST: https://gist.github.com/djravine/376e81a018ba2b980750a5578deb3935 这篇关于sudo a2enmod php5.6,php -v仍然显示php 7.01冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-01 17:24