关于 apache:在 PHP5 存在的情况下删除 PHP 7 后 Apache2 不起作用

Apache2 doesn't work after removing PHP 7 while PHP5 exists

我想将我在 Ubuntu 中的 PHP 版本从 7.1 更改为 5.6,我卸载了 PHP7,但现在我无法运行 Apache2。我已经安装了 PHP5.6。
当我尝试重新启动 apache 服务时出现此错误:

Job for apache2.service failed because the control process exited with
error code. See"systemctl status apache2.service" and"journalctl
-xe" for details.

● apache2.service - LSB: Apache2 web server Loaded: loaded
(/etc/init.d/apache2; generated; vendor preset: enabled) Drop-In:
/lib/systemd/system/apache2.service.d
└─apache2-systemd.conf Active: failed (Result: exit-code) since Mon 2017-01-30 10:23:28 CET; 2min 35s ago
Docs: man:systemd-sysv-generator(8) Process: 15026 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 15052 ExecStart=/etc/init.d/apache2 start (code=exited,
status=1/FAILURE)

*
* The apache2 configtest failed. Output of config test was: apache2: Syntax error on line 216 of /etc/apache2/apache2.conf: Could not open
configuration file /etc/apache2/conf-enabled/phpmyadmin.conf: No such
file or Action 'configtest' failed. The Apache error log may have
more information. apache2.service: Control process exited, code=exited
status=1 Failed to start LSB: Apache2 web server. apache2.service:
Unit entered failed state. apache2.service: Failed with result
'exit-code'.


删除 PHP 并安装新的 php5,然后安装新的 phpmyadmin。
首先,您需要删除所有与 PHP 相关的包,因为以确保不会有冲突的包,这也是我认为最简单的方法。删除使用

1
sudo apt-get remove php7*

现在安装 PHP5.* ( 5.6 )