|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
restarting services via PHP
I know this sounds bad, and there considerable security implications. However, we are setting up an admin page from our secure server and need t restart a couple of services (httpd and named).
Now, this may be impossible since you are restarting the server via script that is being run on the server - a bit of a catch 22 scenario. Was wondering if anyone had got this working or done something similar? |
|
#2
|
|||
|
|||
|
Forget mod_php and use PERL at all time for this kind of task.
Start here -> http://forums.devshed.com/showthrea...23249&forumid=6 |
|
#3
|
|||
|
|||
|
Thanks, however, I'm not having a problem restarting named, it's sendmail and httpd that are causing a problem.
I'm getting the following errors: Stopping httpd: [FAILED] Starting httpd: Ouch! ap_mm_create(1048576, "/var/run/httpd.mm.4165") failed Error: MM: mm:core: failed to open semaphore file (Permission denied): OS: No such file or directory [FAILED] Shutting down sendmail: [FAILED] Starting sendmail: 501 Permission denied [FAILED] I presume that your script could be used to do a similar thing for the above, is it actually necessary to run it as CGI rather than PHP? |
|
#4
|
|||
|
|||
|
>> I presume that your script could be used to do a similar thing for the above
Definitely. For restarting Apache, however, you would see something like Connection reset return to browser because your http session is terminated. But still, Apache will be restarted. >> is it actually necessary to run it as CGI rather than PHP? Not necessary if you run Apache as root, which is plain bad. It's not whether it's necessary to do it with CGI, it's the fact that it's IMPOSSIBLE to do it with mod_php. |
|
#5
|
|||
|
|||
|
Ok thanks, I'll post more in the other forum.
|
|
#6
|
||||
|
||||
|
I know this isn't an answer, but here's my thoughts on the whole thing:
Do you really want to give the ability to restart the server to folks who can't figure out how to do it from a shell? Ah well. I know most clueful techies would cring at the thought. This must be coming down from management. Good luck, and remember what mom told you- "always listen to freebsd. s/he knows thier poop!". |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > restarting services via PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|