Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 8441

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Files which make up an extension</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="internals2.structure.html">Extension structure</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="internals2.structure.basics.html">Basic constructs</a></div>
 <div class="up"><a href="internals2.structure.html">Extension structure</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="internals2.structure.files" class="sect1">
  <h2 class="title">Files which make up an extension</h2>
  <p class="para">
   Whether created by hand, using <strong class="command">ext_skel</strong>, or by an
   alternate extension generator, such as
   <a href="http://codegenerators.php-baustelle.de/" class="link external">&raquo;&nbsp;CodeGen</a>,
   all extensions will have at least four files:
  </p>

  <dl>

   <dt>

    <span class="term"><var class="filename">config.m4</var></span>
    <dd>

     <p class="para">
      UNIX build system configuration (see
      <a href="internals2.buildsys.configunix.html" class="xref">Talking to the UNIX build system: config.m4</a>)
     </p>
    </dd>

   </dt>


   <dt>

    <span class="term"><var class="filename">config.w32</var></span>
    <dd>

     <p class="para">
      Windows buildsystem configuration (see
      <a href="internals2.buildsys.configwin.html" class="xref">Talking to the Windows build system: config.w32</a>)
     </p>
    </dd>

   </dt>

   
   <dt>

    <span class="term"><var class="filename">php_counter.h</var></span>
    <dd>

     <p class="para">
      When building an extension as static module into the PHP binary the
      build system expects a header file with <em>php_</em>
      prepended to the extension name which includes a declaration for a
      pointer to the extension&#039;s module structure. This file usually contains
      additional macros, prototypes, and globals, just like any header.
     </p>
    </dd>

   </dt>

   
   <dt>

    <span class="term"><var class="filename">counter.c</var></span>
    <dd>

     <p class="para">
      Main extension source file. By convention, the name of this file
      is the extension name, but this is not a requirement. This file
      contains the module structure declaration, INI entries, management
      functions, userspace functions, and other requirements of an extension.
     </p>
    </dd>

   </dt>

  </dl>

  
  <p class="para">
   The buildsystem files are discussed elsewhere; this section concentrates on
   the rest. These four files make up the bare minimum for an extension, which
   may also contain any number of headers, source files, unit tests, and other
   support files. The list of files in the counter extension might look like
   this:
  </p>
  
  <div class="example" id="internals2.structure.files.ex1">
   <p><strong>Example #1 Files in the counter extension, in no particular order</strong></p>
   <div class="example-contents screen">
<div class="cdata"><pre>
ext/
 counter/
  .svnignore
  config.m4
  config.w32
  counter_util.h
  counter_util.c
  php_counter.h
  counter.c
  package.xml
  CREDITS
  tests/
   critical_function_001.phpt
   critical_function_002.phpt
   optional_function_001.phpt
   optional_function_002.phpt
</pre></div>
   </div>
  </div> 
  
  <div class="sect2" id="internals2.structure.files.misc-files">
   <h3 class="title">Non-source files</h3>
   <p class="para">
    The <var class="filename">.svnignore</var> file is used for extensions which are
    checked into the PHP <strong class="command">Subversion</strong> repository (usually
    <a href="http://pecl.php.net/" class="link external">&raquo;&nbsp;PECL</a>); the one generated by <strong class="command">ext_skel</strong> contains:
   </p>
  
   <div class="informalexample">
    <div class="example-contents">
<div class="svnignorecode"><pre class="svnignorecode">.deps
*.lo
*.la</pre>
</div>
    </div>

   </div>
  
   <p class="para">
    These lines tell <strong class="command">Subversion</strong> to ignore interim files generated
    by the PHP buildsystem. This is only a convenience, and can be omitted
    completely without ill effect.
   </p>
   
   <p class="para">
    The <var class="filename">CREDITS</var> file lists the contributors and/or
    maintainers of the extension in plain text format. The main purpose of 
    this file is generating the credits information for bundled extensions as
    used by  <span class="function"><a href="function.phpcredits.html" class="function">phpcredits()</a></span>. By convention the first line of
    the file should hold the name of the extension, the second a comma 
    separated list of contributors. The contributors are usually ordered by the
    chronological order of their contributions. In a <a href="http://pecl.php.net/" class="link external">&raquo;&nbsp;PECL</a> package,
    this information is already maintained in <var class="filename">package.xml</var>,
    for example. This is another file which can be omitted without ill effect.
   </p>
   
   <p class="para">
    The <var class="filename">package.xml</var> file is specific to <a href="http://pecl.php.net/" class="link external">&raquo;&nbsp;PECL</a>-based
    extensions; it is a metainformation file which gives details about an
    extension&#039;s dependencies, authors, installation requirements, and other
    tidbits. In an extension not being hosted in <a href="http://pecl.php.net/" class="link external">&raquo;&nbsp;PECL</a>, this file is
    extraneous.
   </p>
  </div>
  
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="internals2.structure.html">Extension structure</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="internals2.structure.basics.html">Basic constructs</a></div>
 <div class="up"><a href="internals2.structure.html">Extension structure</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>