<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.pcntl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.pcntl-exec.php',
    1 => 'pcntl_exec',
    2 => '現在のプロセス空間で指定したプログラムを実行する',
  ),
  'up' => 
  array (
    0 => 'ref.pcntl.php',
    1 => 'PCNTL 関数',
  ),
  'prev' => 
  array (
    0 => 'function.pcntl-errno.php',
    1 => 'pcntl_errno',
  ),
  'next' => 
  array (
    0 => 'function.pcntl-fork.php',
    1 => 'pcntl_fork',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/pcntl/functions/pcntl-exec.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pcntl-exec" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pcntl_exec</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pcntl_exec</span> &mdash; <span class="dc-title">現在のプロセス空間で指定したプログラムを実行する</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.pcntl-exec-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">function</span> <span class="methodname"><strong>pcntl_exec</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$path</code></span>, <span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$args</code><span class="initializer"> = []</span></span>, <span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$env_vars</code><span class="initializer"> = []</span></span>): <span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></div>

  <p class="para rdfs-comment">
   指定した引数でプログラムを実行します。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pcntl-exec-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">path</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">path</code> は、バイナリ実行ファイルへのパスか、
       あるいは有効な実行ファイルを指す shebang (例: #!/usr/local/bin/perl)
       が一行目に存在するスクリプトへのパスである必要があります。
       詳細な情報については、システムの man ページで execve(2) を参照ください。
      </p>
     </dd>
    
    
     <dt><code class="parameter">args</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">args</code>
       は、プログラムに渡す引数文字列の配列です。
      </p>
     </dd>
    
    
     <dt><code class="parameter">env_vars</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">env_vars</code> は、プログラムに渡す環境変数の配列です。
       この配列は name =&gt; value のような形式で、key が環境変数名・value が
       その値となります。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pcntl-exec-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="simpara">
   失敗した場合に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
   成功した場合は、現在のプロセスイメージが、実行するプログラムで置き換えられるため、
   この関数から処理が戻ることはありません。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.pcntl-exec-errors">
  <h3 class="title">エラー / 例外</h3>
  <p class="simpara">
   PHP 8.5.0 以降では、<code class="parameter">args</code> のいずれかの要素にヌルバイトが含まれている場合、
   あるいは <code class="parameter">env_vars</code> のいずれかの要素またはキーにヌルバイトが含まれている場合に、
   <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> がスローされます。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.pcntl-exec-changelog">
  <h3 class="title">変更履歴</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.5.0</td>
      <td>
       <code class="parameter">args</code> のいずれかの要素にヌルバイトが含まれている場合、
       あるいは <code class="parameter">env_vars</code> のいずれかの要素またはキーにヌルバイトが含まれている場合に、
       <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> がスローされるようになりました。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.pcntl-exec-seealso">
  <h3 class="title">参考</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.pcntl-fork.php" class="function" rel="rdfs-seeAlso">pcntl_fork()</a> - 現在実行中のプロセスをフォークする</span></li>
   <li><span class="function"><a href="function.pcntl-waitpid.php" class="function" rel="rdfs-seeAlso">pcntl_waitpid()</a> - 待つかフォークした子プロセスのステータスを返す</span></li>
   <li><span class="function"><a href="function.exec.php" class="function" rel="rdfs-seeAlso">exec()</a> - 外部プログラムを実行する</span></li>
   <li><span class="function"><a href="function.proc-open.php" class="function" rel="rdfs-seeAlso">proc_open()</a> - コマンドを実行し、入出力用にファイルポインタを開く</span></li>
  </ul>
 </div>


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