Systemd fails to start httpd service

systemctl status httpd
× httpd.service - Apache Web Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Wed 2024-02-14 13:25:07 CET; 38min ago
   Duration: 2.871s
    Process: 791 ExecStart=/usr/bin/httpd -k start -DFOREGROUND (code=exited, status=1/FAILURE)
   Main PID: 791 (code=exited, status=1/FAILURE)
        CPU: 87ms

févr. 14 13:25:04 hafid-hp systemd[1]: Started Apache Web Server.
févr. 14 13:25:07 hafid-hp httpd[791]: httpd: Syntax error on line 192 of /etc/httpd/conf/httpd.conf: Cannot load modules/libphp7.so into server: /etc/httpd>
févr. 14 13:25:07 hafid-hp systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
févr. 14 13:25:07 hafid-hp systemd[1]: httpd.service: Failed with result 'exit-code'.

What is the problem and how to fix it ?

Hi @hafid,

It’s kind of obvious, isn’t it:

Looks like PHP isn’t installed. Check with:

pamac search --installed php
1 Like

LANG=en pacman -Qi php

Name            : php
Version         : 8.2.14-1
Description     : A general-purpose scripting language that is especially suited to web development
Architecture    : x86_64
URL             : https://www.php.net/
Licenses        : PHP
Groups          : None
Provides        : php-interpreter=8.2  php-intl=8.2.14
Depends On      : libxml2  curl  libzip  pcre2  argon2  oniguruma
Optional Deps   : None
Required By     : php-apache  php-gd
Optional For    : None
Conflicts With  : php-intl
Replaces        : php-intl
Installed Size  : 26.82 MiB
Packager        : Pierre Schmitz <pierre@archlinux.org>
Build Date      : Thu Dec 21 15:02:51 2023
Install Date    : Sat Dec 23 20:53:52 2023
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature


And the error mentions PHP 7 while you have installed PHP 8:

So somewhere there’s a version mismatch. Reinstall PHP. but the latest version, while you’re at it, and reconfigure Apache to use that and not try to use version 7’s.

2 Likes

Syntax error on line 192 → open the file and look at that line?

3 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.