<?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.passthru.php',
    1 => 'passthru',
    2 => 'F&uuml;hrt ein externes Programm aus und zeigt dessen Ausgabe an',
  ),
  'up' => 
  array (
    0 => 'ref.exec.php',
    1 => 'Funktionen zur Programmausf&uuml;hrung',
  ),
  'prev' => 
  array (
    0 => 'function.exec.php',
    1 => 'exec',
  ),
  'next' => 
  array (
    0 => 'function.proc-close.php',
    1 => 'proc_close',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/exec/functions/passthru.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.passthru" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">passthru</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">passthru</span> &mdash; <span class="dc-title">Führt ein externes Programm aus und zeigt dessen Ausgabe an</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.passthru-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>passthru</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="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter reference">&$result_code</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Die Funktion <span class="function"><strong>passthru()</strong></span> ähnelt der Funktion
   <span class="function"><a href="function.exec.php" class="function">exec()</a></span>, da sie ebenfalls ein
   <code class="parameter">command</code> ausführt. Diese Funktion sollte anstelle von
   <span class="function"><a href="function.exec.php" class="function">exec()</a></span> bzw. <span class="function"><a href="function.system.php" class="function">system()</a></span> verwendet
   werden, wenn die Ausgabe des Unix-Befehls binäre Daten erzeugt, die direkt
   an den Browser zurückgegeben werden sollen. Ein praktisches Beispiel
   hierfür ist die Ausführung eines Programms wie pbmplus, welches einen
   Bildstream direkt ausgibt. Wenn der Content-Type auf
   <code class="literal">image/gif</code> gesetzt wird und dann das pbmplus-Programm
   aufgerufen wird, um ein GIF zu erzeugen, kann auf diesem Weg mittels PHP
   direkt ein Bild erzeugt und ausgegeben werden.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.passthru-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>
    
    
     <dt><code class="parameter">result_code</code></dt>
     <dd>
      <p class="para">
       Ist der Parameter <code class="parameter">result_code</code> angegeben, wird der
       Rückgabestatus des UNIX-Befehls hier abgelegt.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.passthru-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt bei Erfolg <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> zurück. Bei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.passthru-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="para">
   Wenn <span class="function"><strong>passthru()</strong></span> den Befehl
   <code class="parameter">command</code> nicht ausführen kann, wird eine Meldung der
   Stufe <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> ausgegeben.
  </p>
  <p class="para">
   Löst einen <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> aus, wenn
   <code class="parameter">command</code> leer ist oder Nullbytes enthält.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.passthru-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       Wenn <code class="parameter">command</code> leer ist oder Nullbytes enthält,
       löst <span class="function"><strong>passthru()</strong></span> nun einen
       <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> aus. Zuvor gab die Funktion ein
       <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> aus und gab <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurück.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 notes" id="refsect1-function.passthru-notes">
  <h3 class="title">Anmerkungen</h3>
  <div class="warning"><strong class="warning">Warnung</strong><p class="para">Falls Sie es erlauben, dass Daten von
Usereingaben an diese Funktion weitergereicht werden, sollten Sie
<span class="function"><a href="function.escapeshellarg.php" class="function">escapeshellarg()</a></span> oder <span class="function"><a href="function.escapeshellcmd.php" class="function">escapeshellcmd()</a></span>
verwenden. Bei Verwendung dieser Funktionen stellen Sie sicher, dass kein
Benutzer Ihr System überlisten kann, beliebige Kommandos auszuführen</p></div>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: <p class="para">Wenn ein Programm mit dieser Funktion
gestartet wird und im Hintergrund weiterlaufen soll, muss die Ausgabe des Programms
in eine Datei oder einen anderen Ausgabestrom umgeleitet werden. Anderenfalls bleibt
PHP solange hängen, bis das Programm zu Ende ausgeführt wurde.</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.passthru-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.system.php" class="function" rel="rdfs-seeAlso">system()</a> - F&uuml;hrt ein externes Programm aus und zeigt dessen Ausgabe an</span></li>
    <li><span class="function"><a href="function.popen.php" class="function" rel="rdfs-seeAlso">popen()</a> - &Ouml;ffnet einen Dateizeiger f&uuml;r einen Prozess</span></li>
    <li><span class="function"><a href="function.escapeshellcmd.php" class="function" rel="rdfs-seeAlso">escapeshellcmd()</a> - Maskiert Metazeichen der Shell</span></li>
    <li><a href="language.operators.execution.php" class="link">Backtick-Operator</a></li>
   </ul>
  </p>
 </div>


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