<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Close a process opened by proc_open and return the exit code of that process</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.passthru.html">passthru</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.proc-get-status.html">proc_get_status</a></div> <div class="up"><a href="ref.exec.html">Program execution Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.proc-close" class="refentry"> <div class="refnamediv"> <h1 class="refname">proc_close</h1> <p class="verinfo">(PHP 4 >= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">proc_close</span> — <span class="dc-title">Close a process opened by <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span> and return the exit code of that process</span></p> </div> <div class="refsect1 description" id="refsect1-function.proc-close-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><strong>proc_close</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$process</code></span> )</div> <p class="para rdfs-comment"> <span class="function"><strong>proc_close()</strong></span> is similar to <span class="function"><a href="function.pclose.html" class="function">pclose()</a></span> except that it only works on processes opened by <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span>. <span class="function"><strong>proc_close()</strong></span> waits for the process to terminate, and returns its exit code. If you have open pipes to that process, you should <span class="function"><a href="function.fclose.html" class="function">fclose()</a></span> them prior to calling this function in order to avoid a deadlock - the child process may not be able to exit while the pipes are open. </p> </div> <div class="refsect1 parameters" id="refsect1-function.proc-close-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">process</code></em></span> <dd> <p class="para"> The <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span> <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> that will be closed. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.proc-close-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the termination status of the process that was run. In case of an error then <em>-1</em> is returned. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.passthru.html">passthru</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.proc-get-status.html">proc_get_status</a></div> <div class="up"><a href="ref.exec.html">Program execution Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>