<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.exec.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.shell-exec.php',
    1 => 'shell_exec',
    2 => 'F&uuml;hrt einen Befehl auf der Shell aus und liefert die komplette Ausgabe als String',
  ),
  'up' => 
  array (
    0 => 'ref.exec.php',
    1 => 'Funktionen zur Programmausf&uuml;hrung',
  ),
  'prev' => 
  array (
    0 => 'function.proc-terminate.php',
    1 => 'proc_terminate',
  ),
  'next' => 
  array (
    0 => 'function.system.php',
    1 => 'system',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/exec/functions/shell-exec.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.shell-exec" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">shell_exec</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">shell_exec</span> &mdash; <span class="dc-title">
   Führt einen Befehl auf der Shell aus und liefert die komplette Ausgabe als String
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.shell-exec-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>shell_exec</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$command</code></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span></div>

  <p class="para rdfs-comment">
   Diese Funktion ist identisch zum
   <a href="language.operators.execution.php" class="link">Backtick-Operator</a>.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Unter Windows wird die darunterliegende Pipe im Textmodus geöffnet, was
    bewirken kann, dass die Funktion für binäre Ausgaben fehlschlägt. Es ist
    zu erwägen, für solche Fälle stattdessen <span class="function"><a href="function.popen.php" class="function">popen()</a></span> zu
    verwenden.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.shell-exec-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">command</code></dt>
     <dd>
      <p class="para">
       Der auszuführende Befehl.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.shell-exec-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Ein <a href="language.types.string.php" class="link">String</a>, der die Ausgabe des ausgeführten Befehls enthält, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>,
   wenn die Pipe nicht angelegt werden kann, oder <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, wenn ein Fehler
   auftrat oder der Befehl keine Ausgabe erzeugt.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Diese Funktion kann <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> zurückgeben, sowohl wenn ein Fehler auftritt als
    auch wenn das Programm keine Ausgabe erzeugt. Es ist nicht möglich, mit
    dieser Funktion das Scheitern der Ausführung festzustellen. Wenn Zugriff
    auf den Exitcode des Programms erforderlich ist, sollte
    <span class="function"><a href="function.exec.php" class="function">exec()</a></span> verwendet werden.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 errors" id="refsect1-function.shell-exec-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="para">
   Ein Fehler der Stufe <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> wird erzeugt, wenn die
   Pipe nicht angelegt werden kann.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.shell-exec-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 Ein <span class="function"><strong>shell_exec()</strong></span>-Beispiel</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$output </span><span style="color: #007700">= </span><span style="color: #0000BB">shell_exec</span><span style="color: #007700">(</span><span style="color: #DD0000">'ls -lart'</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"&lt;pre&gt;</span><span style="color: #0000BB">$output</span><span style="color: #DD0000">&lt;/pre&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.shell-exec-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.exec.php" class="function" rel="rdfs-seeAlso">exec()</a> - F&uuml;hrt ein externes Programm aus</span></li>
    <li><span class="function"><a href="function.escapeshellcmd.php" class="function" rel="rdfs-seeAlso">escapeshellcmd()</a> - Maskiert Metazeichen der Shell</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>