daemons listen on apache port when run by php
| From: | Dusan Smolnikar | Date: | Mon, 27 Jun 2005 13:06:34 +0000 |
| Subject: | daemons listen on apache port when run by php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-217681@lists.php.net to get a copy of this message | ||
I am trying to run a daemon via php4 & apache2 (on debian sarge). I am using the
command "exec('sh script.sh');". All works fine, my daemon (which I run with
script.sh) is running. But when I stop apache, I can see that the daemon I ran
previously is listening on port 80 (apache port). This does not happen if I run
the script from a shell. How can I prevent these daemons from taking over port
80?
This happens with amule and giftd (haven't tried any others though).
this is my script:
#!/bin/bash
HOME=/var/www
case "$1" in
start)
/usr/bin/giftd -dq --home-dir '/var/www'
;;
stop)
killall giftd
;;
restart | force-reload)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: gift.sh {start|stop|restart|force-reload}" exit 1
esac
exit 0
the command used in php:
exec('./gift.sh start');
what I get when I stop apache, after I ran the script:
[router:/var/www/.giFT] racer% sudo netstat -np --ip --listen | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2522/giftd
Dusan Smolnikar