Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5546

Re: problems with exec()

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: problems with exec()
Date Mon, 16 Apr 2012 19:29:52 +0200
Lines 27
Message-ID <9v338gFtdpU1@mid.individual.net> (permalink)
References <9-SdnWmoCP7eZBfSnZ2dnUVZ7q6dnZ2d@giganews.com> <9v0fldFforU1@mid.individual.net> <9v0vlnF4m6U2@mid.uni-berlin.de> <9v100mF8g6U1@mid.uni-berlin.de> <9v1oc1FvdvU1@mid.individual.net> <4f8bd352$0$21937$426a34cc@news.free.fr>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace individual.net YXu9XSt7vXU2qzvJb1hxaQ/mB3OijUYFLNwK+tsCVLKewkjzYX
Cancel-Lock sha1:TD2SCrOWw6iyaytvZlGGvPbHlvM=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120321 Firefox/11.0 SeaMonkey/2.8
In-Reply-To <4f8bd352$0$21937$426a34cc@news.free.fr>
Xref csiph.com comp.lang.php:5546

Show key headers only | View raw


Une Bévue wrote:
> Le 16/04/2012 07:17, J.O. Aho a écrit :
>>>
>>> php> $a = exec('/sbin/ifconfig');
>>> php> echo $a;
>>> php> var_dump($a);
>>> string(0) ""
>>
>> Think the ifconfig makes a bit environment check and wants a shell, use
>> shell_exec instead and you will see the output.
>>
>
> On Ubuntu 11.10, this works very well :
> $lines=explode("\n", shell_exec('/sbin/ifconfig'));
> foreach ($lines as $line) {
> echo "$line<br />";
> }
>
> may be the prob i had creating an ssh tunnel comes also from the difference
> between "exec" and "shell_exec" ?

I suspect it could have the same issue, try to use shell_exec and let us know 
if it works.

-- 

   //Aho

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

problems with exec() 7segment <7segment@nowhere.com> - 2012-04-15 11:37 -0500
  Re: problems with exec() 7segment <7segment@nowhere.com> - 2012-04-15 11:47 -0500
    Re: problems with exec() Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-15 13:34 -0400
  Re: problems with exec() "J.O. Aho" <user@example.net> - 2012-04-15 19:43 +0200
    Re: problems with exec() "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-16 00:16 +0200
      Re: problems with exec() "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-16 00:22 +0200
        Re: problems with exec() "J.O. Aho" <user@example.net> - 2012-04-16 07:17 +0200
          Re: problems with exec() Une Bévue <unbewusstsein@fai.invalid> - 2012-04-16 10:07 +0200
            Re: problems with exec() "J.O. Aho" <user@example.net> - 2012-04-16 19:29 +0200
              Re: problems with exec() Une Bévue <unbewusstsein@fai.invalid> - 2012-04-18 15:44 +0200
                Re: problems with exec() "J.O. Aho" <user@example.net> - 2012-04-18 18:02 +0200
                Re: problems with exec() Une Bévue <unbewusstsein@fai.invalid> - 2012-04-18 19:43 +0200
                Re: problems with exec() "J.O. Aho" <user@example.net> - 2012-04-18 20:37 +0200
                Re: problems with exec() Une Bévue <unbewusstsein@fai.invalid> - 2012-04-18 23:31 +0200
  Re: problems with exec() Kim André Akerø <kimandre@nospambetadome.com> - 2012-04-16 13:27 +0200
    Re: problems with exec() "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-16 14:43 +0200

csiph-web