Score:1

apache2 failed exit code 18.04 to 20.04 with php8

gb flag

Almost the same exact question as another here, but none of the answers helped me..

I upgraded ubuntu 18.04 to 20.04. Running systemctl restart apache2 gives me,

● 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.

The syntax error on line 128 is because I put the following in apache2.conf,

CoreDumpDirectory /tmp/mycoredump

On line 128. I also followed these steps,

    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

But this is also not working. The dir mycoredump is owned by www-data and set to 777.... So, Im guessing it has something to do with PrivateTmp=true (Found in other threads) BUT im stretched too thin to pull on these threads. ;-(

The results of 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)

and I have run,

sudo a2dismod php*
sudo a2enmod php8.0

Running sudo apache2ctl configtest gives me,

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

Any and all help, greatly appreciated !

in flag
Looks like you’re following [this ServerFault answer](https://serverfault.com/a/470410). The reason for the error should be captured in `/var/log/apache2/error`, though I would guess that AppArmor is blocking access to the directory. The `777` bit is rarely a good idea, though, and dropping that to `755` may help.
Hoops avatar
gb flag
Error and access logs are 0 bytes. AppArmor... hmmm 1st im hearing of this... stay tuned...
Hoops avatar
gb flag
Just ran sudo systemctl stop apparmor.service sudo systemctl disable apparmor.service and no luck, no start and still no logs
Hoops avatar
gb flag
Had do disable php8, enable php7.4, reinstall php-mysql and Im back....
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.