Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!not-for-mail From: "M. Strobel" Newsgroups: comp.lang.php Subject: Re: problems with exec() Date: Mon, 16 Apr 2012 14:43:16 +0200 Lines: 41 Message-ID: <9v2if4Fu3uU1@mid.uni-berlin.de> References: <9-SdnWmoCP7eZBfSnZ2dnUVZ7q6dnZ2d@giganews.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de m3Ny+j9hMdllALgvx1hEkg8bY44T1ES0XxwkYkN4REmbCrIrk= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 In-Reply-To: Xref: csiph.com comp.lang.php:5543 Am 16.04.2012 13:27, schrieb Kim Andr=C3=A9 Aker=C3=B8: > P=C3=A5 Sun, 15 Apr 2012 18:37:23 +0200, skrev 7segment <7segment@nowhe= re.com>: >=20 >> Hi. >> >> I have an interesting problem and I cannot figure out what the problem= >> might be. >> >> This does not produce any output: >> >> $response =3D exec('ifconfig'); >> echo $response[0]; >> >> Although when I try other commands, I get a response on the screen. So= I >> don't get what's so special about ifconfig. >> >> Could anyone help please? >=20 > Based on your corrected code in your own reply, which lists the second = line as "echo > $response;", I can see what you problem would be. >=20 > Even if you're allowed to run this particular command from your PHP scr= ipt, the > return value of exec() is always the LAST line of the command output. O= n my system, > the last line of the "ifconfig" command is always blank, which is what = $response in > your code example would contain. Try instead to do it like this (and, p= referrably, > include the full path of ifconfig): Very convincing, thank you. I was about to test why ifconfig would need t= he shell environment... /Str.