termux/termux-packages

Apache2 service won't stop

Open

#3,268 opened on Jan 24, 2019

View on GitHub
 (11 comments) (2 reactions) (0 assignees)Shell (4,089 forks)batch import
bug reporthelp wantedinactive

Repository metrics

Stars
 (16,216 stars)
PR merge metrics
 (Avg merge 3d 5h) (153 merged PRs in 30d)

Description

I can start the server fine. The qualified domain name error is pretty common error when you first test apache. I'm having trouble stopping the service though.

using

apachectl stop
apachectl -k stop
apachectl graceful-stop
apachectl -k graceful-stop

does not kill the server.

~ $ apachectl stop
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(20014)Internal error (specific information not available): AH00058: Error retrieving pid file var/run/apache2/httpd.pid
AH00059: Remove it before continuing if it is corrupted.

also killall and removing the pid file doesn't kill the server.

killall -9 httpd 
rm ${PREFIX}/var/run/apache2/httpd.pid

cleared cache in browser to double check after running kill commands and nothing happens. the process still runs in the background.

ps aux | grep httpd

also comes back up empty handed.

mlocate also comes up empty handed

whereis apache

this is not okay, especially if in a public network.

also there is no var/www/html as far as i can tell

find ${PREFIX} -type d -name 'www'

returns nothing.

server root is set to $PREFIX which leads to a dead end.

after poking around ${PREFIX}/etc/apache2/httpd.conf, i find document root is set to ${PREFIX}/share/apache2/default-site/htdocs which breaks convention, but considering termux doesn't have the standard heiarchy, this makes sense in a weird way. I would still have left it as ${PREFIX}/var/www, but its not a big deal.

After looking at the error log

[Thu Jan 24 14:30:39.045826 2019] [mpm_worker:notice] [pid 1245540143613296114:tid 2950133044] AH00292: Apache/2.4.37 (Unix) configured -- resuming normal operations
[Thu Jan 24 14:30:39.050164 2019] [core:notice] [pid -4688630529333919578:tid 2950133044] AH00094: Command line: '/data/data/com.termux/files/usr/bin/httpd'
[Thu Jan 24 14:42:23.027754 2019] [mpm_worker:notice] [pid 1245540143613296114:tid 2854847796] AH00292: Apache/2.4.37 (Unix) configured -- resuming normal operations
[Thu Jan 24 14:42:23.033791 2019] [core:notice] [pid -4698130309797904218:tid 2854847796] AH00094: Command line: '/data/data/com.termux/files/usr/bin/httpd'

I found no real helpful clues.

because apachectl is a wrapper for httpd, i looked at the shell script to see if there was anything special about it aside from config options which led to lynx (haven't looked at it yet though).

i decided to run the stop commands using httpd -k directly, but that didnt do anything either.

  1. Android warning/error log: logcat -d "*:W".
~ $ logcat -d "*:W"
--------- beginning of main
01-24 15:11:38.267  3743  3743 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
01-24 15:11:38.268  3743  3743 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
01-24 15:14:51.821  3743  3743 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
01-24 15:14:51.822  3743  3743 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
01-24 15:25:04.064  3743  3743 E ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
01-24 15:25:04.065  3743  3743 E ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
01-24 15:25:04.065  3743  3743 E ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
01-24 15:25:04.065  3743  3743 E ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
01-24 15:25:24.120  3743  3743 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
01-24 15:25:24.121  3743  3743 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
  1. Output of strace: strace -fv -s 2048 -o strace.log {program name}.
~ $ strace -fv -s 2048 -o strace.log httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(20014)Internal error (specific information not available): AH00058: Error retrieving pid file var/run/apache2/httpd.pid
AH00059: Remove it before continuing if it is corrupted.
  1. If program write it's own log files, you may need to attach them.
[Thu Jan 24 14:30:39.045826 2019] [mpm_worker:notice] [pid 1245540143613296114:tid 2950133044] AH00292: Apache/2.4.37 (Unix) configured -- resuming normal operations
[Thu Jan 24 14:30:39.050164 2019] [core:notice] [pid -4688630529333919578:tid 2950133044] AH00094: Command line: '/data/data/com.termux/files/usr/bin/httpd'
[Thu Jan 24 14:42:23.027754 2019] [mpm_worker:notice] [pid 1245540143613296114:tid 2854847796] AH00292: Apache/2.4.37 (Unix) configured -- resuming normal operations
[Thu Jan 24 14:42:23.033791 2019] [core:notice] [pid -4698130309797904218:tid 2854847796] AH00094: Command line: '/data/data/com.termux/files/usr/bin/httpd'

UPDATE: After some trial and error, ps aux returned the httpd PIDs and I was able to use kill -SIGINT {PID} to end the process.

Its still weird that ps aux didn't pick up on this until last minute though. Maybe something to do with the terminal session.

I created new terminal sessions to open files with less to check them out and on the last tty i decided to give a try again and this time it showed up.

After clearing the browser cache, I was able to verify that the httpd service had ended. I stil have no idea why the processes wouldn't show up after starting apache though.

Contributor guide