<?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 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.passthru.php',
    1 => 'passthru',
    2 => 'Execute an external program and display raw output',
  ),
  'up' => 
  array (
    0 => 'ref.exec.php',
    1 => 'Program execution Функції',
  ),
  'prev' => 
  array (
    0 => 'function.exec.php',
    1 => 'exec',
  ),
  'next' => 
  array (
    0 => 'function.proc-close.php',
    1 => 'proc_close',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    '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">Execute an external program and display raw output</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.passthru-description">
  <h3 class="title">Опис</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">
   The <span class="function"><strong>passthru()</strong></span> function is similar to the
   <span class="function"><a href="function.exec.php" class="function">exec()</a></span> function in that it executes a
   <code class="parameter">command</code>. This function
   should be used in place of <span class="function"><a href="function.exec.php" class="function">exec()</a></span> or
   <span class="function"><a href="function.system.php" class="function">system()</a></span> when the output from the Unix command
   is binary data which needs to be passed directly back to the
   browser.  A common use for this is to execute something like the
   pbmplus utilities that can output an image stream directly.  By
   setting the Content-type to <code class="literal">image/gif</code> and
   then calling a pbmplus program to output a gif, you can create
   PHP scripts that output images directly.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.passthru-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">command</code></dt>
     <dd>
      <p class="para">
       The command that will be executed.
      </p>
     </dd>
    
    
     <dt><code class="parameter">result_code</code></dt>
     <dd>
      <p class="para">
       If the <code class="parameter">result_code</code> argument is present, the 
       return status of the Unix command will be placed here.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.passthru-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Повертає <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> у разі успіху або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.passthru-errors">
  <h3 class="title">Помилки/виключення</h3>
  <p class="para">
   Will emit an <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> if <span class="function"><strong>passthru()</strong></span>
   is unable to execute the <code class="parameter">command</code>.
  </p>
  <p class="para">
   Throws a <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> if <code class="parameter">command</code>
   is empty or contains null bytes.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.passthru-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       If <code class="parameter">command</code> is empty or contains null bytes,
       <span class="function"><strong>passthru()</strong></span> now throws a <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span>.
       Previously it emitted an <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> and returned <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 notes" id="refsect1-function.passthru-notes">
  <h3 class="title">Примітки</h3>
  <div class="warning"><strong class="warning">Увага</strong><p class="para">Варто застосувати
<span class="function"><a href="function.escapeshellarg.php" class="function">escapeshellarg()</a></span> або <span class="function"><a href="function.escapeshellcmd.php" class="function">escapeshellcmd()</a></span> до
даних, введених користувачами, щоб гарантувати, що користувачі не зможуть
обманом змусити систему виконати довільні команди.</p></div>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: <p class="para">Якщо програма запускається за
допомогою цієї функції, то для продовження роботи у фоновому режимі її вивід
повинен спрямовуватись у файл або інший вихідний потік. Недотримання цієї умови
змусить PHP виконувати програму до її завершення.</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.passthru-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.exec.php" class="function" rel="rdfs-seeAlso">exec()</a> - Execute an external program</span></li>
    <li><span class="function"><a href="function.system.php" class="function" rel="rdfs-seeAlso">system()</a> - Execute an external program and display the output</span></li>
    <li><span class="function"><a href="function.popen.php" class="function" rel="rdfs-seeAlso">popen()</a> - Opens process file pointer</span></li>
    <li><span class="function"><a href="function.escapeshellcmd.php" class="function" rel="rdfs-seeAlso">escapeshellcmd()</a> - Escape shell metacharacters</span></li>
    <li><a href="language.operators.execution.php" class="link">backtick operator</a></li>
   </ul>
  </p>
 </div>

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