<?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 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.shell-exec.php',
    1 => 'shell_exec',
    2 => 'Esegue un comando attraverso la shell e restituisce l\'output completo come stringa',
  ),
  'up' => 
  array (
    0 => 'ref.exec.php',
    1 => 'Program execution Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.proc-terminate.php',
    1 => 'proc_terminate',
  ),
  'next' => 
  array (
    0 => 'function.system.php',
    1 => 'system',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    '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">Esegue un comando attraverso la shell e restituisce l&#039;output completo come stringa</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.shell-exec-description">
  <h3 class="title">Descrizione</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">$cmd</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Questa funzione è identica all&#039;<a href="language.operators.execution.php" class="link">operatore backtick</a>.
  </p>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    In Windows, la pipe sottostante viene aperta in modalità testo, il che può causare il
    il fallimento della funzione per l&#039;output binario. È da considerare l&#039;uso di <span class="function"><a href="function.popen.php" class="function">popen()</a></span>
    per questi casi.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.shell-exec-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">cmd</code></dt>
     <dd>
      <p class="para">
       Il comando che verrà eseguito.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.shell-exec-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   L&#039;output del comando eseguito o <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> se si è verificato un errore o il
   comando non produce alcun output.
  </p>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Questa funzione può restituire <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> sia quando si verifica un errore sia quando il programma
    non produce output. Non è possibile rilevare errori di esecuzione utilizzando
    questa funzione. Dovrebbe essere usato <span class="function"><a href="function.exec.php" class="function">exec()</a></span> quando è richiesto l&#039;accesso
    al codice di uscita del programma.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 examples" id="refsect1-function.shell-exec-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Un esempio di <span class="function"><strong>shell_exec()</strong></span></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">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.exec.php" class="function" rel="rdfs-seeAlso">exec()</a> - Esegue un programma esterno</span></li>
    <li><span class="function"><a href="function.escapeshellcmd.php" class="function" rel="rdfs-seeAlso">escapeshellcmd()</a> - Elude i metacaratteri della shell</span></li>
   </ul>
  </p>
 </div>

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