apache2 使用 php8 失败退出代码 18.04 至 20.04

apache2 使用 php8 失败退出代码 18.04 至 20.04

几乎和这里的另一个问题完全一样,但没有一个答案对我有帮助。

我将 ubuntu 18.04 升级到了 20.04。运行 systemctl restart apache2 后,

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2021-10-07 19:54:59 EDT; 28s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 63572 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Oct 07 19:54:59 glenn-VirtualBox systemd[1]: Starting The Apache HTTP Server...
Oct 07 19:54:59 glenn-VirtualBox apachectl[63586]: AH00526: Syntax error on line 128 of /etc/apache2/apache2.conf:
Oct 07 19:54:59 glenn-VirtualBox apachectl[63586]: CoreDumpDirectory /tmp/mycoredump does not exist
Oct 07 19:54:59 glenn-VirtualBox apachectl[63572]: Action 'start' failed.
Oct 07 19:54:59 glenn-VirtualBox apachectl[63572]: The Apache error log may have more information.
Oct 07 19:54:59 glenn-VirtualBox systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Oct 07 19:54:59 glenn-VirtualBox systemd[1]: apache2.service: Failed with result 'exit-code'.
Oct 07 19:54:59 glenn-VirtualBox systemd[1]: Failed to start The Apache HTTP Server.

第 128 行的语法错误是因为我在 apache2.conf 中输入了以下内容,

CoreDumpDirectory /tmp/mycoredump

在第 128 行。我也遵循了以下步骤,

    Set up the directive as follow
    CoreDumpDirectory /tmp/mycoredump
    Create the directory:
    mkdir -p /tmp/mycoredump
    Assign ownership to the directory www-data or httpd
    chown -R www-data:www-data /tmp/mycoredump
    Set permissions to:
    chmod 777 /tmp/mycoredump
    Restart Apache:
    service apache2 restart

但这也不起作用。目录 mycoredump 归 www-data 所有,并设置为 777.... 所以,我猜它与 PrivateTmp=true 有关(在其他线程中找到)但我太忙了,无法参与这些线程。;-(

sudo a2query -m 的结果

php8.0 (enabled by site administrator)
access_compat (enabled by maintainer script)
dir (enabled by maintainer script)
authz_core (enabled by maintainer script)
deflate (enabled by maintainer script)
authn_file (enabled by maintainer script)
negotiation (enabled by maintainer script)
ssl (enabled by site administrator)
mpm_prefork (enabled by maintainer script)
auth_basic (enabled by maintainer script)
authz_host (enabled by maintainer script)
authz_user (enabled by maintainer script)
filter (enabled by maintainer script)
dnssd (enabled by maintainer script)
headers (enabled by site administrator)
autoindex (enabled by maintainer script)
setenvif (enabled by maintainer script)
mime (enabled by maintainer script)
reqtimeout (enabled by maintainer script)
socache_shmcb (enabled by site administrator)
env (enabled by maintainer script)
alias (enabled by maintainer script)
rewrite (enabled by site administrator)
authn_core (enabled by maintainer script)
status (enabled by maintainer script)

我已经跑了,

sudo a2dismod php*
sudo a2enmod php8.0

运行 sudo apache2ctl configtest 会给我,

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
Syntax OK

如有任何帮助,我们将不胜感激!

相关内容