php-general Digest 27 Jul 2008 18:50:28 -0000 Issue 5592

Topics (messages 277367 through 277372):

Start/Stop Service from program php
        277367 by: opc.orenses.com
        277368 by: Micah Gersten
        277371 by: Daniel Brown

Re: Regular Expression help need
        277369 by: Richard Heyes
        277370 by: James Dempster

SOLUTION [Fwd: Start/Stop Service from program php]
        277372 by: opc.orenses.com

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
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 ...

--- End Message ---
--- Begin Message ---
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


[EMAIL PROTECTED] wrote:
> 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 ...
>
>   

--- End Message ---
--- Begin Message ---
On Sat, Jul 26, 2008 at 11:48 PM, Micah Gersten <[EMAIL PROTECTED]> wrote:
> Generally, apache runs as www-data.  What was the output of the command?

    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.

--- End Message ---
--- Begin Message ---
> Before: <p>hi <strong>Richard</strong>>, & good morning&lt;</p>
> After:   <p>hi <strong>Richard</strong>&gt;, &amp; good morning&lt;</p>

By the sounds of it negative look ahead assertions may be of some
help. Or look behind assertions.

-- 
Richard Heyes
http://www.phpguru.org

--- End Message ---
--- Begin Message ---
On Fri, Jul 25, 2008 at 1:08 PM, Shelley <[EMAIL PROTECTED]> wrote:

> Hi Richard,
>
> Not exactly actually.
>
> What I mean is:
> Before: <p>hi <strong>Richard</strong>>, & good morning&lt;</p>
> After:   <p>hi <strong>Richard</strong>&gt;, &amp; good morning&lt;</p>
>
> I hope it's clear now.
>
> On Fri, Jul 25, 2008 at 7:53 PM, Richard Heyes <[EMAIL PROTECTED]>
> wrote:
>
> > > How can I make a string with & (NOT &amp;, &gt;, &lt; or &quot;), <, >
> > xml
> > > compatible?
> > > What is the expression to use?
> >
> > Not entirely sure what you're after (try posting some before and after
> > snippets), but by the sounds of it you don't need a regular expression
> > - strtr() will work for you. Or str_replace().
> >
> > --
> > Richard Heyes
> > http://www.phpguru.org
> >
>
>
>
> --
> Regards,
> Shelley
>


Is it possible for you to use a mixture of html_entity_decode, htmlentities
e.g.

<?php
$content = html_entity_decode('>, & good morning&lt;');
echo '<p>hi <strong>Richard</strong>'.htmlentities($content).'</p>';

/James

--- End Message ---
--- Begin Message ---
In the /var/log/secure i can see

"sudo: apache : sorry, you must have a tty to run sudo; TTY:unknown...."

So, i edit line and comment in visudo to next

### Default requiretty

And, eureka, work fine from a web page

Thanks all

---------------------------- Mensaje original ----------------------------
Asunto: Start/Stop Service from program php
De:     [EMAIL PROTECTED]
Fecha:  Sab, 26 de Julio de 2008, 11:02 pm
Para:   [EMAIL PROTECTED]
--------------------------------------------------------------------------

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 ...


+---------------------
Ing. Oswaldo Peñaloza C.
EMPSETEL CIA. LTDA. - ORENSES.COM
Proveedor Autorizado de Servicios de Internet
Recaudación y Ventas: 9 de Mayo # 2011 e/ Bolívar y Pichincha
Tlf. 07-2923-958
Nodo: 5ta Norte # 509 e/ Buenavista y Colón
Tlf. 07-2922-396
Soporte Técnico: 093-310-310
Machala - Ecuador


--- End Message ---

Reply via email to