迁移到 ubuntu 18.04 后,Apache2 Web 服务器正在运行但无法提供服务

迁移到 ubuntu 18.04 后,Apache2 Web 服务器正在运行但无法提供服务

我非常感谢您的帮助;我花了几天时间尝试纠正这个问题。

基本上,只有停用 php7.2 后,我的 Web 服务器才能正常运行。

首先我尝试停用所有 PHP 版本

sudo a2dismod php7.2
sudo a2dismod php5
sudo a2dismod php7.0
sudo systemctl restart apache2

没有错误,Web 服务器正常运行,为 Wordpress 提供服务。现在让我们启用 php7.2

sudo a2enmod php7.2
sudo systemctl restart apache2
sudo a2query -m php7.2
>php7.2 (enabled by site administrator)

现在 Web 服务器无法工作。无法为 WordPress 提供服务。未显示任何错误

 sudo systemctl status apache2
● 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: active (running) since Sat 2020-01-04 20:13:26 AEDT; 2min 13s ago
  Process: 24208 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 9759 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
  Process: 24213 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 24218 (apache2)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/apache2.service
           ├─24218 /usr/sbin/apache2 -k start
           └─24219 /usr/sbin/apache2 -k start

Jan 04 20:13:25 UBSERVER systemd[1]: Starting The Apache HTTP Server...
Jan 04 20:13:26 UBSERVER apachectl[24213]: [Sat Jan 04 20:13:26.025305 2020] [alias:warn] [pid 24216] AH00671: The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably nev
Jan 04 20:13:26 UBSERVER systemd[1]: Started The Apache HTTP Server.

/var/log/apache2/error.log 中的一些错误

/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
[Sat Jan 04 20:16:39.820165 2020] [core:notice] [pid 24218] AH00051: child pid 25534 exit signal Segmentation fault (11), possible coredump in /etc/apache2
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
[Sat Jan 04 20:16:40.824374 2020] [core:notice] [pid 24218] AH00051: child pid 25536 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:40.824452 2020] [core:notice] [pid 24218] AH00051: child pid 25537 exit signal Segmentation fault (11), possible coredump in /etc/apache2
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
[Sat Jan 04 20:16:41.032015 2020] [core:notice] [pid 24218] AH00051: child pid 25540 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.032106 2020] [core:notice] [pid 24218] AH00051: child pid 25541 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.032134 2020] [core:notice] [pid 24218] AH00051: child pid 25542 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.032156 2020] [core:notice] [pid 24218] AH00051: child pid 25545 exit signal Segmentation fault (11), possible coredump in /etc/apache2
/usr/sbin/apache2: Relink `/lib/x86_64-linux-gnu/libnss_systemd.so.2' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
[Sat Jan 04 20:16:41.376926 2020] [core:notice] [pid 24218] AH00051: child pid 25554 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.376971 2020] [core:notice] [pid 24218] AH00051: child pid 25555 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.376990 2020] [core:notice] [pid 24218] AH00051: child pid 25556 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.377008 2020] [core:notice] [pid 24218] AH00051: child pid 25557 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.377026 2020] [core:notice] [pid 24218] AH00051: child pid 25560 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.377043 2020] [core:notice] [pid 24218] AH00051: child pid 25563 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.377060 2020] [core:notice] [pid 24218] AH00051: child pid 25567 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Sat Jan 04 20:16:41.377103 2020] [mpm_prefork:notice] [pid 24218] AH00169: caught SIGTERM, shutting down
[Sat Jan 04 20:17:31.165424 2020] [ssl:warn] [pid 25660] AH01906: ub-server.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sat Jan 04 20:17:31.165441 2020] [ssl:warn] [pid 25660] AH01909: ub-server.com:443:0 server certificate does NOT include an ID which matches the server name

答案1

解决问题: sudo nano /etc/php/7.2/cli/php.ini 取消推荐 gd2 扩展:extension=gd2 删除、清除并安装 php7.2-gd 加载模块:phpenmod -v 7.2 php7.2-gd 重新启动 appache2 sudo systemctl restart apache2

相关内容