If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
Ok I found out this is harder than it sounds. First I tried a php script to run a setuid file that did the httpd restart. But, since apache is running php it won't run code to restart itself. So, I came up with some C to do it for me and stuck it in a CGI. Unfortunately, it doesn't work. I know it's possible because Plesk does it.
Hmm, maybe have a separately-launched process reading on a FIFO or a TCP socket, and have the CGI script pass some kind of authenticating token to it, which triggers the httpd reload?
Apache forked processes (such as CGI) runs as the user "www" which doesn't have permission to restart Apache.
You'll need to have a way to elevate privileges to root to restart apache and be extremely careful not to introduce any security issues (it's much harder than it looks to do this).
You'll want to use the command /usr/sbin/apachectl graceful to do the restart as this will mean it won't terminate currently active connections.