How can I start Web Agent using systemctl instead apachectl?

Document ID : KB000107936
Last Modified Date : 30/07/2018
Show Technical Document Details
Question:
We just installed and configured a new Web Agent on an Apache 2.4 server running in RHEL7. The installation and configuration went fine, but when we start the service we get the following errors:

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/etc/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2018-07-26 08:57:56 EDT; 5s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 8830 ExecStopPost=/usr/bin/kdestroy -A (code=exited, status=0/SUCCESS)
  Process: 8827 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 8824 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
  Process: 8822 ExecStartPre=/usr/libexec/ipa/ipa-httpd-kdcproxy (code=exited, status=0/SUCCESS)
 Main PID: 8824 (code=exited, status=1/FAILURE)

Jul 26 08:57:48 myserver systemd[1]: Starting The Apache HTTP Server...
Jul 26 08:57:56 myserver ipa-httpd-kdcproxy[8822]: ipa         : WARNING  Unable to connect to dirsrv: Timeout exceeded
Jul 26 08:57:56 myserver ipa-httpd-kdcproxy[8822]: ipa         : WARNING  Disabling KDC proxy
Jul 26 08:57:56 myserver httpd[8824]: httpd: Syntax error on line 56 of /etc/httpd/conf/httpd.conf: Cannot load /CA/webagent/bin/libmod_sm24.so into server: libsmerrlog.so: cannot open shared object file: No such file or directory
Jul 26 08:57:56 myserver systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 26 08:57:56 myserver kill[8827]: kill: cannot find process ""
Jul 26 08:57:56 myserver systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 26 08:57:56 myserver systemd[1]: Failed to start The Apache HTTP Server.
Jul 26 08:57:56 myserver systemd[1]: Unit httpd.service entered failed state.
Jul 26 08:57:56 myserver systemd[1]: httpd.service failed.


We have sourced the environment variables, and the user has full rights on all the files in the bin folder and the files mentioned in the error. 

How can we solve this problem?
Environment:
Web Agent R12.52 SP1 on RHEL7 (Apache web server)
Answer:
In order to start the Apache web server as a service with the systemctl commands (systemctl stop/start httpd.service), you need to ensure the sysconfig httpd file has the environment variables added into it. To do this, edit the /etc/sysconfig/httpd file and add the following:

#
# This file can be used to set additional environment variables for
# the httpd process, or pass additional options to the httpd
# executable.
#
# Note: With previous versions of httpd, the MPM could be changed by
# editing an "HTTPD" variable here.  With the current version, that
# variable is now ignored.  The MPM is a loadable module, and the
# choice of MPM can be changed by editing the configuration file
# /etc/httpd/conf.modules.d/00-mpm.conf.
#
# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.
#
#OPTIONS=
#
# This setting ensures the httpd process is started in the "C" locale
# by default.  (Some modules will not behave correctly if
# case-sensitive string comparisons are performed in a different
# locale.)
#
#LANG=C
NETE_WA_ROOT=/CA/webagent
NETE_WA_PATH=/CA/webagent/bin
CAPKIHOME=/CA/webagent/CAPKI
LD_LIBRARY_PATH=/CA/webagent/bin:/CA/webagent/bin/thirdparty:${LD_LIBRARY_PATH}
PATH=NETE_WA_PATH=/CA/webagent/bin:${PATH}

PATH=$PATH:/CA/webagent/bin
export PATH


Note that "/CA/webagent" is the path used as a sample, but it should be your Web Agent home path.