1

Found following on systemctl status httpd.service on Cent OS 7. Apache 2.4.41 is compiled and installed. There is not such message on Cent OS 6.

systemd[1]: Can't open PID file /var/run/httpd.pid (yet?) after start: No such file or directory

Even though this showing in status server start and stop are working fine.

Here is service file:

cat /run/systemd/generator.late/httpd.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8) 
SourcePath=/etc/rc.d/init.d/httpd 
Description=LSB: start and stop Apache HTTP Server 
Before=shutdown.target 
After=remote-fs.target 
After=network-online.target 
After=nss-lookup.target 
After=distcache.service 
Wants=network-online.target 
Conflicts=shutdown.target

[Service]
Type=forking Restart=no
TimeoutSec=5min 
IgnoreSIGPIPE=no 
KillMode=process 
GuessMainPID=no 
RemainAfterExit=no 
PIDFile=/var/run/httpd.pid 
ExecStart=/etc/rc.d/init.d/httpd start 
ExecStop=/etc/rc.d/init.d/httpd stop 
ExecReload=/etc/rc.d/init.d/httpd reload


/etc/httpd/conf/extra/httpd-mpm.conf

<IfModule !mpm_netware_module>
    PidFile "/var/run/httpd.pid"
</IfModule>

Any idea?

2 Answers2

1

Looks like in your Apache config file PidFile not exist or not set according your .service file. You should set it to PidFile /var/run/httpd.pid to remove this error, or change your .service file to set proper path to existing Apache pid file.

Alexander Tolkachev
  • 4,608
  • 3
  • 14
  • 23
0

You are seeing this error because you compiled and installed Apache from source, and it hasn't been configured properly.

If the file /var/run/httpd.pid does not exist, you need to correct it. On my CentOS 7 system with the included version of Apache, it is found at /run/httpd/httpd.pid

You can change the path in the unit file. However, I would recommend installing Apache from a package repository if you want to run a newer version than what is included with CentOS, or you will run into many issues like this that you will have to troubleshoot.

When you compile and install software yourself, you will have to support it yourself.

Bert
  • 2,863
  • 12
  • 13
  • 1
    We have compiled and installed latest 2.4.41. The PID file in created in the same path but not sure why this warning shows on status check. When I comment the PIDFile=/var/run/httpd.pid entry from service file, the warning is not showing. In both case, there is PID file in the same path. – Valsaraj Viswanathan Feb 25 '20 at 16:22