Problem with my Linux daemon
Help me to solve following problem.
I have: Red Hat Linux release 9 (Shrike) + Apache 2.0.40. I have written small PHP script which executes the C++ program (myprogram) using exec() function. myprogram does fork() and runs as daemon. myprogram opens one outbound tcp connection and does not listen any ports. After calling PHP script from browser, it runs C++ program, all works fine. Now I wish to stop web server. I do: service httpd stop. The server stops. But when I have tried to start it again, have seen such mistake: make_sock: could not bind to address 0.0.0.0:443 no listening sockets available, shutting down I have entered netstat -nlp and have seen the following: Code:
Active Internet connections (only servers) How it can be? And how I can fix it? Thanks. |
hi,
i don't know anything about php. but in c exec() actually replaces the calling process so the connection is most likely being passed as an argument to the new process. also exec() never returns which is why in c you would fork before you use exec so exec becomes a child and gets killed off when the parent dies. |
All times are GMT -5. The time now is 08:02 PM. |