<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/features.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'features.commandline.php',
    1 => 'Nutzung der Kommandzeile',
    2 => 'Nutzung von PHP auf der Kommandozeile',
  ),
  'up' => 
  array (
    0 => 'features.php',
    1 => 'Features',
  ),
  'prev' => 
  array (
    0 => 'features.persistent-connections.php',
    1 => 'Persistente Datenbankverbindungen',
  ),
  'next' => 
  array (
    0 => 'features.commandline.differences.php',
    1 => 'Unterschiede zu anderen SAPIs',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'features/commandline.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/features.commandline.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="features.commandline" class="chapter">
 <h1 class="title">Nutzung von PHP auf der Kommandozeile</h1>
<h2>Inhaltsverzeichnis</h2><ul class="chunklist chunklist_chapter"><li><a href="features.commandline.differences.php">Unterschiede zu anderen SAPIs</a></li><li><a href="features.commandline.options.php">Optionen</a></li><li><a href="features.commandline.usage.php">Verwendung</a></li><li><a href="features.commandline.io-streams.php">I/O Streams</a></li><li><a href="features.commandline.interactive.php">Interaktive Shell</a></li><li><a href="features.commandline.webserver.php">Eingebauter Webserver</a></li><li><a href="features.commandline.ini.php">INI-Einstellungen</a></li></ul>

 

 
 <div id="features.commandline.introduction" class="section">
  <h2 class="title">Introduction</h2>
  <p class="para">
   Das Hauptaugenmerk der <abbr title="Command Line Interpreter/Interface">CLI</abbr> <abbr title="Server Application Programming Interface">SAPI</abbr> liegt auf der Entwicklung von
   Kommandozeilenanwendungen. Es gibt einige Unterschiede zwischen der
   <abbr title="Command Line Interpreter/Interface">CLI</abbr> <abbr title="Server Application Programming Interface">SAPI</abbr> und anderen <abbr title="Server Application Programming Interface">SAPI</abbr>s, welche in diesem Kapitel
   beschrieben werden. Es ist erwähnenswert, dass <abbr title="Command Line Interpreter/Interface">CLI</abbr> und
   <abbr title="Common Gateway Interface">CGI</abbr> verschiedene <abbr title="Server Application Programming Interface">SAPI</abbr>s sind, auch
   wenn sie viele Verhaltensweisen teilen.
  </p>
  <p class="para">
   Die <abbr title="Command Line Interpreter/Interface">CLI</abbr> <abbr title="Server Application Programming Interface">SAPI</abbr> ist standardmäßig durch die Option
   <strong class="option configure">--enable-cli</strong> aktiviert, kann jedoch durch
   Angabe der Option <strong class="option configure">--disable-cli</strong> im
   <strong class="command">./configure</strong>-Skript deaktiviert werden.
  </p>
  <p class="para">
   Der Name, der Pfad und das Vorhandensein der
   <abbr title="Command Line Interpreter/Interface">CLI</abbr>/<abbr title="Common Gateway Interface">CGI</abbr>-Binaries hängt davon ab, wie PHP auf dem
   System installiert wurde. Standarmäßig werden nach dem Aufruf von
   <strong class="command">make</strong> sowohl <abbr title="Common Gateway Interface">CGI</abbr> als auch <abbr title="Command Line Interpreter/Interface">CLI</abbr>
   kompiliert und als <var class="filename">sapi/cgi/php-cgi</var> beziehungsweise
   <var class="filename">sapi/cli/php</var> in Ihrem PHP-Quellcodeverzeichnis
   gespeichert. Sie werden bemerken, dass beide <var class="filename">php</var>
   heißen. Was während <strong class="command">make install</strong> passiert, hängt davon
   ab, wie PHP konfiguriert wurde. Wenn bei der Konfiguration eine
   Modul-<abbr title="Server Application Programming Interface">SAPI</abbr> wie z. B. apxs gewählt wurde oder die Option
   <strong class="option configure">--disable-cgi</strong> genutzt wurde, wird die
   <abbr title="Command Line Interpreter/Interface">CLI</abbr> während <strong class="command">make install</strong> nach
   <var class="filename">{PREFIX}/bin/php</var> kopiert. Andernfalls wird das
   <abbr title="Common Gateway Interface">CGI</abbr>-Binary dorthin kopiert. Also wird, wenn
   beispielsweise <strong class="option configure">--with-apxs</strong> in Ihrem
   configure-Kommando angegeben ist, die <abbr title="Command Line Interpreter/Interface">CLI</abbr> während <strong class="command">make
   install</strong> nach <var class="filename">{PREFIX}/bin/php</var> kopiert. Wenn
   Sie die Installation des <abbr title="Common Gateway Interface">CGI</abbr>-Binaries überschreiben
   wollen, verwenden Sie <strong class="command">make install-cli</strong> nach
   <strong class="command">make install</strong>. Alternativ können Sie
   <strong class="option configure">--disable-cgi</strong> in Ihrem configure-Kommando
   angeben.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Weil sowohl <strong class="option configure">--enable-cli</strong> als auch
    <strong class="option configure">--enable-cgi</strong> standardmäßig eingeschaltet
    sind, muss <strong class="option configure">--enable-cli</strong> in Ihrem
    configure-Kommando nicht zwingend bedeuten, dass die <abbr title="Command Line Interpreter/Interface">CLI</abbr> während
    <strong class="command">make install</strong> nach <var class="filename">{PREFIX}/bin/php</var>
    kopiert wird.
   </p>
  </p></blockquote>
  <p class="para">
   Auf Windows wird das <abbr title="Command Line Interpreter/Interface">CLI</abbr>-Binary im Hauptordner als
   <var class="filename">php.exe</var> ausgeliefert. Die
   <abbr title="Common Gateway Interface">CGI</abbr>-Version wird als <var class="filename">php-cgi.exe</var>
   bereitgestellt. Zusätzlich wird <var class="filename">php-win.exe</var>
   ausgeliefert, wenn PHP mit
   <strong class="option configure">--enable-cli-win32</strong> konfiguriert wurde.
   Dieses Binary verhält sich genauso wie die <abbr title="Command Line Interpreter/Interface">CLI</abbr>-Version, bis auf die
   Tatsache, dass sie nichts ausgibt und somit keine Konsole zur Verfügung
   stellt.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <strong>Welche SAPI habe ich?</strong><br />
   <p class="para">
    Auf der Kommandozeile wird Ihnen die Eingabe von <strong class="command">php -v</strong>
    verraten, ob Sie <var class="filename">php</var> als <abbr title="Common Gateway Interface">CGI</abbr> oder
    <abbr title="Command Line Interpreter/Interface">CLI</abbr> einsetzen. Sehen Sie sich auch die Funktion
    <span class="function"><a href="function.php-sapi-name.php" class="function">php_sapi_name()</a></span> und die Konstante
    <strong><code><a href="reserved.constants.php#constant.php-sapi">PHP_SAPI</a></code></strong> an.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Eine UNIX-<code class="literal">man</code>page ist durch Eingabe von
    <strong class="command">man php</strong> auf der Kommandozeile verfügbar.
   </p>
  </p></blockquote>
 </div>
 

 
 
 

 
 
 

 
 
 

 
 
 

 
 
 

 
 
 

 

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