You are here: [PHP] daemons listen on apache port when run by php « PHP « IT news, forums, messages
[PHP] daemons listen on apache port when run by php

Posted by Dusan Smolnikar on 06/27/05 16:06

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация