Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > Start/Stop Service from program php
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 21st November 06:30
External User
 
Posts: 1
Default Start/Stop Service from program php



Hi

I try execute unsucesfull the next code from web page

<?php
$cmd1 = shell_exec ("sudo /sbin/service named stop");
echo "$cmd1";
?>

I need write a script execute some command, but try start or stop service
like named, network this don't work

I edit visudo and add the next lines

User_Alias MYGROUP = apache, xyz
Cmnd_Alias MYCOMMAND = /sbin/service
%MYGROUP ALL = MYCOMMAND
%MYGROUP ALL=(ALL) NOPASSWD: ALL

But don't work.

Suggest? Thanks ...
  Reply With Quote


 


2 21st November 06:30
micah
External User
 
Posts: 1
Default Start/Stop Service from program php



Generally, apache runs as www-data. What was the output of the command?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


I need write a script execute some command, but try start or stop service
like named, network this don't work

I edit visudo and add the next lines

User_Alias MYGROUP = apache, xyz
  Reply With Quote
3 21st November 06:30
parasane
External User
 
Posts: 1
Default Start/Stop Service from program php


Actually, Apache generally runs (in order) as nobody, apache,
httpd, or daemon. Some distros (such as Ubuntu) or control panel
installations (such as Plesk) change this default. For example,
Ubuntu Feisty uses 'www-data', and Plesk uses a group of 'psacln'.

From PHP, if system access (i.e. - exec(), passthru(), etc.) is
allowed, the easiest way to find out which user you are with Apache on
*NIX is to run this file in a browser: <?php echo `whoami`;
?> --
</Daniel P. Brown>
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.
  Reply With Quote
Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Php 5 forum, Apache forum, Iis forum, Functions forum, Classes forum, Librarys forum, Bugs forum, Postgres forum, Mysql forum, Paradox forum, Ms sql forum, Configurations forum, Php.ini forum, Problems forum, Scripting forum, Css forum, General forums, Off-topic talk, Links, Extra forums, Php


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666