Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 13th, 2001, 04:38 AM
danp danp is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Sheffield, UK
Posts: 28 danp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old November 13th, 2001, 08:44 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Forget mod_php and use PERL at all time for this kind of task.
Start here -> http://forums.devshed.com/showthrea...23249&forumid=6

Reply With Quote
  #3  
Old November 13th, 2001, 09:35 AM
danp danp is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Sheffield, UK
Posts: 28 danp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #4  
Old November 13th, 2001, 09:45 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> 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.

Reply With Quote
  #5  
Old November 13th, 2001, 11:04 AM
danp danp is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Sheffield, UK
Posts: 28 danp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ok thanks, I'll post more in the other forum.

Reply With Quote
  #6  
Old November 13th, 2001, 11:42 AM
Hero Zzyzzx's Avatar
Hero Zzyzzx Hero Zzyzzx is offline
11
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jul 2001
Location: Lynn, MA
Posts: 4,635 Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hero Zzyzzx User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 23 h 44 m 19 sec
Reputation Power: 77
Send a message via AIM to Hero Zzyzzx
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!".

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > restarting services via PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT