exec() problem

exec() problem

am 14.11.2009 22:20:30 von newsgroups

Hi all,

i've a problem using exec() on a Linux server with PHP 5.2.9 on Apache
2.2.13. Safe mode is OFF and Apache isn't chrooted.

I would run /usr/lib/mailman/bin/find_member -l so i used
exec("sudo run /usr/lib/mailman/bin/find_member -l
",$output) and set /etc/sudoers with apache ALL=NOPASSWD:
/usr/lib/mailman/bin/find_member but it doesn't work.

I tried simple commands "/bin/ls" works, "sudo -V" work but "sudo
/bin/ls" doesn't work.

I get return code 1 and no messages in logs..

What is worng?

Thanks

Alessandro

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: exec() problem

am 14.11.2009 22:43:56 von Ashley Sheridan

--=-SzS42xUadmAGF/Jr50HX
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sat, 2009-11-14 at 22:20 +0100, A. Mannini wrote:

> Hi all,
>
> i've a problem using exec() on a Linux server with PHP 5.2.9 on Apache
> 2.2.13. Safe mode is OFF and Apache isn't chrooted.
>
> I would run /usr/lib/mailman/bin/find_member -l so i used
> exec("sudo run /usr/lib/mailman/bin/find_member -l
> ",$output) and set /etc/sudoers with apache ALL=NOPASSWD:
> /usr/lib/mailman/bin/find_member but it doesn't work.
>
> I tried simple commands "/bin/ls" works, "sudo -V" work but "sudo
> /bin/ls" doesn't work.
>
> I get return code 1 and no messages in logs..
>
> What is worng?
>
> Thanks
>
> Alessandro
>


Did you mean to put 'run' into the exec call?

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-SzS42xUadmAGF/Jr50HX--

Re: exec() problem

am 15.11.2009 00:06:31 von newsgroups

Ashley Sheridan ha scritto:
>
> Have you checked to ensure that the exec is actually running at all?
> Check the error logs to see what they say. There may be a problem with
> the string argument for exec(), like an unescaped character that is
> causing an issue
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

Yes i had no messages in Apache logs so i tried to use error_log in
php.ini but again no messages.
Don't know if there is a way to see what php module interpeter and try
to execute.

Thanks

Alessandro

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: exec() problem

am 15.11.2009 00:12:09 von Ashley Sheridan

--=-L2Ob8gVSSnuKvtyotlcW
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:

> Ashley Sheridan ha scritto:
> >
> > Have you checked to ensure that the exec is actually running at all?
> > Check the error logs to see what they say. There may be a problem with
> > the string argument for exec(), like an unescaped character that is
> > causing an issue
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
>
> Yes i had no messages in Apache logs so i tried to use error_log in
> php.ini but again no messages.
> Don't know if there is a way to see what php module interpeter and try
> to execute.
>
> Thanks
>
> Alessandro
>


I think for something like that, you should be looking at your system
logs, as that's likely where the errors would log.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-L2Ob8gVSSnuKvtyotlcW--

Re: exec() problem

am 15.11.2009 00:23:21 von Ashley Sheridan

--=-nBYx6JgHwwF+eYswJIyr
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sun, 2009-11-15 at 00:25 +0100, A. Mannini wrote:

> Ashley Sheridan ha scritto:
> > On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:
> >
> >> Ashley Sheridan ha scritto:
> >>> Have you checked to ensure that the exec is actually running at all?
> >>> Check the error logs to see what they say. There may be a problem with
> >>> the string argument for exec(), like an unescaped character that is
> >>> causing an issue
> >>>
> >>> Thanks,
> >>> Ash
> >>> http://www.ashleysheridan.co.uk
> >>>
> >>>
> >> Yes i had no messages in Apache logs so i tried to use error_log in
> >> php.ini but again no messages.
> >> Don't know if there is a way to see what php module interpeter and try
> >> to execute.
> >>
> >> Thanks
> >>
> >> Alessandro
> >>
> >
> >
> > I think for something like that, you should be looking at your system
> > logs, as that's likely where the errors would log.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
>
> Looked to all log...nothing! :-(
>


What other logs did you look at?

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-nBYx6JgHwwF+eYswJIyr--

Re: exec() problem

am 15.11.2009 00:25:15 von newsgroups

Ashley Sheridan ha scritto:
> On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:
>
>> Ashley Sheridan ha scritto:
>>> Have you checked to ensure that the exec is actually running at all?
>>> Check the error logs to see what they say. There may be a problem with
>>> the string argument for exec(), like an unescaped character that is
>>> causing an issue
>>>
>>> Thanks,
>>> Ash
>>> http://www.ashleysheridan.co.uk
>>>
>>>
>> Yes i had no messages in Apache logs so i tried to use error_log in
>> php.ini but again no messages.
>> Don't know if there is a way to see what php module interpeter and try
>> to execute.
>>
>> Thanks
>>
>> Alessandro
>>
>
>
> I think for something like that, you should be looking at your system
> logs, as that's likely where the errors would log.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

Looked to all log...nothing! :-(

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: exec() problem

am 15.11.2009 00:36:52 von Kim Madsen

Ashley Sheridan wrote on 2009-11-15 00:23:

>> Looked to all log...nothing! :-(
>>
>
>
> What other logs did you look at?

Then do this from a command line:

su - "the user apache runs as"

copy the command from the ph script and run it from commandline and let
us see the error you recieve...

--
Kind regards
Kim Emax - masterminds.dk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: exec() problem

am 15.11.2009 00:40:59 von newsgroups

Ashley Sheridan ha scritto:
> On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:
>
>> Ashley Sheridan ha scritto:
>>> Have you checked to ensure that the exec is actually running at all?
>>> Check the error logs to see what they say. There may be a problem with
>>> the string argument for exec(), like an unescaped character that is
>>> causing an issue
>>>
>>> Thanks,
>>> Ash
>>> http://www.ashleysheridan.co.uk
>>>
>>>
>> Yes i had no messages in Apache logs so i tried to use error_log in
>> php.ini but again no messages.
>> Don't know if there is a way to see what php module interpeter and try
>> to execute.
>>
>> Thanks
>>
>> Alessandro
>>
>
>
> I think for something like that, you should be looking at your system
> logs, as that's likely where the errors would log.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

Ok i found that Fedora has, as default, a line Defaults requiretty in
/etc/sudoers, i disabled that ....but i get a different message.

sudo: no tty present and no askpass program specified


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: exec() problem [SOLVED]

am 15.11.2009 00:46:27 von newsgroups

Ashley Sheridan ha scritto:
> On Sun, 2009-11-15 at 00:06 +0100, A. Mannini wrote:
>
>> Ashley Sheridan ha scritto:
>>> Have you checked to ensure that the exec is actually running at all?
>>> Check the error logs to see what they say. There may be a problem with
>>> the string argument for exec(), like an unescaped character that is
>>> causing an issue
>>>
>>> Thanks,
>>> Ash
>>> http://www.ashleysheridan.co.uk
>>>
>>>
>> Yes i had no messages in Apache logs so i tried to use error_log in
>> php.ini but again no messages.
>> Don't know if there is a way to see what php module interpeter and try
>> to execute.
>>
>> Thanks
>>
>> Alessandro
>>
>
>
> I think for something like that, you should be looking at your system
> logs, as that's likely where the errors would log.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

Ok commenting out Defaults requiretty now it works!

The second message "
sudo: no tty present and no askpass program specified" was due to wrong
command issued during tests.

Many thanks

Alessandro

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php