我正在尝试在 Ubuntu 上安装 php5 和 php7,因为我有 php5 和 php7 站点,需要能够切换。
我尝试过这个:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
但是当我尝试启动 apache 时:
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
ERROR: Module php7.0 does not exist!
ERROR: Module php5.6 does not exist!
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
那么我得到的是这个状态:
systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Sun 2018-03-04 20:39:47 -03; 2min 37s ago
Process: 12997 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
mar 04 20:39:47 user-Lenovo-ideapad-320-15IKB systemd[1]: Starting The Apache HTTP Server...
mar 04 20:39:47 user-Lenovo-ideapad-320-15IKB apachectl[12997]: apache2: Could not open configuration file /etc/apache2/apache2.conf: No such file or directory
mar 04 20:39:47 user-Lenovo-ideapad-320-15IKB apachectl[12997]: Action 'start' failed.
mar 04 20:39:47 user-Lenovo-ideapad-320-15IKB apachectl[12997]: The Apache error log may have more information.
mar 04 20:39:47 user-Lenovo-ideapad-320-15IKB systemd[1]: apache2.service: Control process exited, code=exited status=1
mar 04 20:39:47 user-Lenovo-ideapad-320-15IKB systemd[1]: Failed to start The Apache HTTP Server.
mar 04 20:39:47 user-Lenovo-ideapad-320-15IKB systemd[1]: apache2.service: Unit entered failed state.
mar 04 20:39:47 user-Lenovo-ideapad-320-15IKB systemd[1]: apache2.service: Failed with result 'exit-code'.
有任何想法吗?