![Apache2,MySql 无法在 ubuntu 18.04 中启动](https://linux22.com/image/1009419/Apache2%EF%BC%8CMySql%20%E6%97%A0%E6%B3%95%E5%9C%A8%20ubuntu%2018.04%20%E4%B8%AD%E5%90%AF%E5%8A%A8.png)
尝试使用以下命令从终端启动 Apache:
systemctl start apache2.service
执行该命令时出现以下错误:
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; disabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2018-08-28 10:59:14 EEST; 4min 37s ago
Process: 1051 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
авг 28 10:59:14 GhostInTheShell apachectl[1051]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
авг 28 10:59:14 GhostInTheShell apachectl[1051]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
авг 28 10:59:14 GhostInTheShell apachectl[1051]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /etc/apache2/sites-enabled/laravel.conf:1
авг 28 10:59:14 GhostInTheShell apachectl[1051]: (2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /etc/apache2/sites-enabled/000-default.conf:1
авг 28 10:59:14 GhostInTheShell apachectl[1051]: AH00014: Configuration check failed
авг 28 10:59:14 GhostInTheShell apachectl[1051]: Action 'start' failed.
авг 28 10:59:14 GhostInTheShell apachectl[1051]: The Apache error log may have more information.
авг 28 10:59:14 GhostInTheShell systemd[1]: apache2.service: Control process exited, code=exited status=1
авг 28 10:59:14 GhostInTheShell systemd[1]: apache2.service: Failed with result 'exit-code'.
авг 28 10:59:14 GhostInTheShell systemd[1]: Failed to start The Apache HTTP Server.
输出journalctl | tail
:
авг 28 11:19:14 GhostInTheShell org.gnome.SettingsDaemon.MediaKeys.desktop[1773]: # Theme parsing error: gtk.css:4423:25: '' is not a valid color name
авг 28 11:19:14 GhostInTheShell org.gnome.SettingsDaemon.MediaKeys.desktop[1773]: # Theme parsing error: gtk.css:4433:25: '' is not a valid color name
авг 28 11:19:14 GhostInTheShell org.gnome.SettingsDaemon.MediaKeys.desktop[1773]: # Theme parsing error: gtk.css:4445:14: unknown value for property
авг 28 11:20:19 GhostInTheShell kernel: [UFW BLOCK] IN=wlp2s0 OUT= MAC=01:00:5e:00:00:01:54:e6:fc:a6:a5:4b:08:00 SRC=0.0.0.0 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2
авг 28 11:22:25 GhostInTheShell kernel: [UFW BLOCK] IN=wlp2s0 OUT= MAC=01:00:5e:00:00:01:54:e6:fc:a6:a5:4b:08:00 SRC=0.0.0.0 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2
авг 28 11:23:32 GhostInTheShell kernel: perf: interrupt took too long (5102 > 5055), lowering kernel.perf_event_max_sample_rate to 39000
авг 28 11:23:38 GhostInTheShell gnome-keyring-daemon[1450]: asked to register item /org/freedesktop/secrets/collection/login/1, but it's already registered
авг 28 11:24:30 GhostInTheShell kernel: [UFW BLOCK] IN=wlp2s0 OUT= MAC=01:00:5e:00:00:01:54:e6:fc:a6:a5:4b:08:00 SRC=0.0.0.0 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2
авг 28 11:26:36 GhostInTheShell kernel: [UFW BLOCK] IN=wlp2s0 OUT= MAC=01:00:5e:00:00:01:54:e6:fc:a6:a5:4b:08:00 SRC=0.0.0.0 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2
авг 28 11:27:00 GhostInTheShell wpa_supplicant[903]: wlp2s0: WPA: Group rekeying completed with 54:e6:fc:a6:a5:4c [GTK=CCMP]
我在 MySQL 中遇到了同样的错误
输出systemctl start mysql.service
:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
输出systemctl status mysql.service
:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2018-08-28 11:37:47 EEST; 6s ago
Process: 6209 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Process: 6200 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
авг 28 11:37:47 GhostInTheShell systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
авг 28 11:37:47 GhostInTheShell systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
авг 28 11:37:47 GhostInTheShell systemd[1]: Stopped MySQL Community Server.
авг 28 11:37:47 GhostInTheShell systemd[1]: mysql.service: Start request repeated too quickly.
авг 28 11:37:47 GhostInTheShell systemd[1]: mysql.service: Failed with result 'exit-code'.
авг 28 11:37:47 GhostInTheShell systemd[1]: Failed to start MySQL Community Server.
答案1
我找到了 Apache 和 MySql 错误的原因。当我使用该程序清理现金、日志等时,我删除了 /var/log/ 中的目录 Apache2 和 MySql
这是解决方案
对于 apache2